JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>getter, setter etc) if there is visibility
* difference
*/
for (POJOPropertyBuilder property : props.values()) {
property.trimByVisibility();
}
/* and, if required, apply wrapper name: note, MUST be done after
* annotations are merged.
*/
if (_config.isEnabled(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)) {
_renameWithWrappers(props);
}
// well, almost last: there's still ordering...
_sortProperties(props);
_properties = props;
_collected = true;
}
/*
/**********************************************************
/* Overridable internal methods, adding members
/**********************************************************
*/
/**
* Method for collecting basic information on all fields found
*/
protected void _addFields(Map<String, POJOPropertyBuilder> props)
{
final AnnotationIntrospector ai = _annotationIntrospector;
/* 28-Mar-2013, tatu: For deserialization we may also want to remove
* final fields, as often they won't make very good mutators...
* (although, maybe surprisingly, JVM _can_ force setting of such fields!)
*/
final boolean pruneFinalFields = !_forSerialization && !_config.isEnabled(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS);
final boolean transientAsIgnoral = _config.isEnabled(MapperFeature.PROPAGATE_TRANSIENT_MARKER);
for (AnnotatedField f : _classDef.fields()) {
String implName = (ai == null) ? null : ai.findImplicitPropertyName(f);
if (implName == null) {
implName = f.getName();
}
PropertyName pn;
if (ai == null) {
pn = null;
} else if (_forSerialization) {
/* 18-Aug-2011, tatu: As per existing unit tests, we should only
* use serialization annotation (@JsonSerialize) when serializing
* fields, and similarly for deserialize-only annotations... so
* no fallbacks in this particular case.
*/
pn = ai.findNameForSerialization(f);
} else {
pn = ai.findNameForDeserialization(f);
}
boolean hasName = (pn != null);
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> (pn != null);
if (!nameExplicit) { // no explicit name; must consider implicit
implName = (ai == null) ? null : ai.findImplicitPropertyName(m);
if (implName == null) {
implName = BeanUtil.okNameForRegularGetter(m, m.getName(), _stdBeanNaming);
}
if (implName == null) { // if not, must skip
implName = BeanUtil.okNameForIsGetter(m, m.getName(), _stdBeanNaming);
if (implName == null) {
return;
}
visible = _visibilityChecker.isIsGetterVisible(m);
} else {
visible = _visibilityChecker.isGetterVisible(m);
}
} else { // explicit indication of inclusion, but may be empty
// we still need implicit name to link with other pieces
implName = (ai == null) ? null : ai.findImplicitPropertyName(m);
if (implName == null) {
implName = BeanUtil.okNameForGetter(m, _stdBeanNaming);
}
// if not regular getter name, use method name as is
if (implName == null) {
implName = m.getName();
}
if (pn.isEmpty()) {
// !!! TODO: use PropertyName for implicit names too
pn = _propNameFromSimple(implName);
nameExplicit = false;
}
visible = true;
}
boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m);
_property(props, implName).addGetter(m, pn, nameExplicit, visible, ignore);
}
protected void _addSetterMethod(Map<String, POJOPropertyBuilder> props,
AnnotatedMethod m, AnnotationIntrospector ai)
{
String implName; // from naming convention
boolean visible;
PropertyName pn = (ai == null) ? null : ai.findNameForDeserialization(m);
boolean nameExplicit = (pn != null);
if (!nameExplicit) { // no explicit name; must follow naming convention
implName = (ai == null) ? null : ai.findImplicitPropertyName(m);
if (implName == null) {
implName = BeanUtil.okNameForMutator(m, _mutatorPrefix, _stdBeanNaming);
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
if (implName == null) { // if not, must skip
return;
}
visible = _visibilityChecker.isSetterVisible(m);
} else { // explicit indication of inclusion, but may be empty
// we still need implicit name to link with other pieces
implName = (ai == null) ? null : ai.findImplicitPropertyName(m);
if (implName == null) {
implName = BeanUtil.okNameForMutator(m, _mutatorPrefix, _stdBeanNaming);
}
// if not regular getter name, use method name as is
if (implName == null) {
implName = m.getName();
}
if (pn.isEmpty()) {
// !!! TODO: use PropertyName for implicit names too
pn = _propNameFromSimple(implName);
nameExplicit = false;
}
visible = true;
}
boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m);
_property(props, implName).addSetter(m, pn, nameExplicit, visible, ignore);
}
protected void _addInjectables(Map<String, POJOPropertyBuilder> props)
{
final AnnotationIntrospector ai = _annotationIntrospector;
if (ai == null) {
return;
}
// first fields, then methods
for (AnnotatedField f : _classDef.fields()) {
_doAddInjectable(ai.findInjectableValueId(f), f);
}
for (AnnotatedMethod m : _classDef.memberMethods()) {
/* for now, only allow injection of a single arg
* (to be changed in future)
*/
if (m.getParameterCount() != 1) {
continue;
}
_doAddInjectable(ai.findInjectableValueId(m), m);
}
}
protected void _doAddInjectable(Object id, AnnotatedMember m)
{
if (id == null) {
return;
}
if (_injectables == null) {
_injectables = new LinkedHashMap<Object, AnnotatedMember>();
}
AnnotatedMember prev = _injectables.put(id, m);
if (prev != null) {
String type = id.getClass().getName();
throw new IllegalArgumentException("Duplicate injectable value with id '"
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
+String.valueOf(id)+"' (of type "+type+")");
}
}
private PropertyName _propNameFromSimple(String simpleName) {
return PropertyName.construct(simpleName, null);
}
/*
/**********************************************************
/* Internal methods; removing ignored properties
/**********************************************************
*/
/**
* Method called to get rid of candidate properties that are marked
* as ignored.
*/
protected void _removeUnwantedProperties(Map<String, POJOPropertyBuilder> props)
{
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// First: if nothing visible, just remove altogether
if (!prop.anyVisible()) {
it.remove();
continue;
}
// Otherwise, check ignorals
if (prop.anyIgnorals()) {
// first: if one or more ignorals, and no explicit markers, remove the whole thing
if (!prop.isExplicitlyIncluded()) {
it.remove();
_collectIgnorals(prop.getName());
continue;
}
// otherwise just remove ones marked to be ignored
prop.removeIgnored();
}
_ignoredPropertyNames.add(name);
}
}
/*
/**********************************************************
/* Internal methods; renaming properties
/**********************************************************
*/
protected void _renameProperties(Map<String, POJOPropertyBuilder> props)
{
// With renaming need to do in phases: first, find properties to rename
Iterator<Map.Entry<String,POJOPropertyBuilder>> it = props.entrySet().iterator();
LinkedList<POJOPropertyBuilder> renamed = null;
while (it.hasNext()) {
Map.Entry<String, POJOPropertyBuilder> entry = it.next();
POJOPropertyBuilder prop = entry.getValue();
Collection<PropertyName> l = prop.findExplicitNames();
// no explicit names? Implicit one is fine as is
if (l.isEmpty()) {
continue;
}
it.remove(); // need to replace with one or more renamed
if (renamed == null) {
renamed = new LinkedList<POJOPropertyBuilder>();
}
// simple renaming? Just do it
if (l.size() == 1) {
PropertyName n =
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> l.iterator().next();
renamed.add(prop.withName(n));
continue;
}
// but this may be problematic...
renamed.addAll(prop.explode(l));
/*
String newName = prop.findNewName();
if (newName != null) {
if (renamed == null) {
renamed = new LinkedList<POJOPropertyBuilder>();
}
prop = prop.withSimpleName(newName);
renamed.add(prop);
it.remove();
}
*/
}
// and if any were renamed, merge back in...
if (renamed != null) {
for (POJOPropertyBuilder prop : renamed) {
String name = prop.getName();
POJOPropertyBuilder old = props.get(name);
if (old == null) {
props.put(name, prop);
} else {
old.addAll(prop);
}
// replace the creatorProperty too, if there is one
_updateCreatorProperty(prop, _creatorProperties);
}
}
}
protected void _renameUsing(Map<String, POJOPropertyBuilder> propMap,
PropertyNamingStrategy naming)
{
POJOPropertyBuilder[] props = propMap.values().toArray(new POJOPropertyBuilder[propMap.size()]);
propMap.clear();
for (POJOPropertyBuilder prop : props) {
PropertyName fullName = prop.getFullName();
String rename = null;
// As per [databind#428] need to skip renaming if property has
// explicitly defined name, unless feature is enabled
if (!prop.isExplicitlyNamed() || _config.isEnabled(MapperFeature.ALLOW_EXPLICIT_PROPERTY_RENAMING)) {
if (_forSerialization) {
if (prop.hasGetter()) {
rename = naming.nameForGetterMethod(_config, prop.getGetter(), fullName.getSimpleName());
} else if (prop.hasField()) {
rename = naming.nameForField(_config, prop.getField(), fullName.getSimpleName());
}
} else {
if (prop.hasSetter()) {
rename = naming.nameForSetterMethod(_config, prop.getSetter(), fullName.getSimpleName());
} else if (prop.hasConstructorParameter()) {
rename = naming.nameForConstructorParameter(_config, prop.getConstructor
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
continue;
}
if (!wrapperName.equals(prop.getFullName())) {
if (renamed == null) {
renamed = new LinkedList<POJOPropertyBuilder>();
}
prop = prop.withName(wrapperName);
renamed.add(prop);
it.remove();
}
}
// and if any were renamed, merge back in...
if (renamed != null) {
for (POJOPropertyBuilder prop : renamed) {
String name = prop.getName();
POJOPropertyBuilder old = props.get(name);
if (old == null) {
props.put(name, prop);
} else {
old.addAll(prop);
}
}
}
}
/*
/**********************************************************
/* Overridable internal methods, sorting, other stuff
/**********************************************************
*/
/* First, order by [JACKSON-90] (explicit ordering and/or alphabetic)
* and then for [JACKSON-170] (implicitly order creator properties before others)
*/
protected void _sortProperties(Map<String, POJOPropertyBuilder> props)
{
// Then how about explicit ordering?
AnnotationIntrospector intr = _annotationIntrospector;
Boolean alpha = (intr == null) ? null : intr.findSerializationSortAlphabetically((Annotated) _classDef);
boolean sort;
if (alpha == null) {
sort = _config.shouldSortPropertiesAlphabetically();
} else {
sort = alpha.booleanValue();
}
String[] propertyOrder = (intr == null) ? null : intr.findSerializationPropertyOrder(_classDef);
// no sorting? no need to shuffle, then
if (!sort && (_creatorProperties == null) && (propertyOrder == null)) {
return;
}
int size = props.size();
Map<String, POJOPropertyBuilder> all;
// Need to (re)sort alphabetically?
if (sort) {
all = new TreeMap<String,POJOPropertyBuilder>();
} else {
all = new LinkedHashMap<String,POJOPropertyBuilder>(size+size);
}
for (POJOPropertyBuilder prop : props.values()) {
all.put(prop.getName(), prop);
}
Map<String,POJOPropertyBuilder> ordered = new LinkedHashMap<
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>String,POJOPropertyBuilder>(size+size);
// Ok: primarily by explicit order
if (propertyOrder != null) {
for (String name : propertyOrder) {
POJOPropertyBuilder w = all.get(name);
if (w == null) { // will also allow use of "implicit" names for sorting
for (POJOPropertyBuilder prop : props.values()) {
if (name.equals(prop.getInternalName())) {
w = prop;
// plus re-map to external name, to avoid dups:
name = prop.getName();
break;
}
}
}
if (w != null) {
ordered.put(name, w);
}
}
}
// And secondly by sorting Creator properties before other unordered properties
if (_creatorProperties != null) {
/* As per [databind#311], this is bit delicate; but if alphabetic ordering
* is mandated, at least ensure creator properties are in alphabetic
* order. Related question of creator vs non-creator is punted for now,
* so creator properties still fully predate non-creator ones.
*/
Collection<POJOPropertyBuilder> cr;
if (sort) {
TreeMap<String, POJOPropertyBuilder> sorted =
new TreeMap<String,POJOPropertyBuilder>();
for (POJOPropertyBuilder prop : _creatorProperties) {
sorted.put(prop.getName(), prop);
}
cr = sorted.values();
} else {
cr = _creatorProperties;
}
for (POJOPropertyBuilder prop : cr) {
// 16-Jan-2016, tatu: Related to [databind#1317], make sure not to accidentally
// add back pruned creator properties!
String name = prop.getName();
if (all.containsKey(name)) {
ordered.put(name, prop);
}
}
}
// And finally whatever is left (trying to put again will not change ordering)
ordered.putAll(all);
props.clear();
props.putAll(ordered);
}
/*
/**********************************************************
/* Internal methods; helpers
/**********************************************************
*/
protected void reportProblem(String msg) {
throw new IllegalArgumentException("Problem with definition of "+_classDef+":
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> "+msg);
}
protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props,
PropertyName name) {
return _property(props, name.getSimpleName());
}
// !!! TODO: deprecate, require use of PropertyName
protected POJOPropertyBuilder _property(Map<String, POJOPropertyBuilder> props,
String implName)
{
POJOPropertyBuilder prop = props.get(implName);
if (prop == null) {
prop = new POJOPropertyBuilder(_config, _annotationIntrospector, _forSerialization,
PropertyName.construct(implName));
props.put(implName, prop);
}
return prop;
}
private PropertyNamingStrategy _findNamingStrategy()
{
Object namingDef = (_annotationIntrospector == null)? null
: _annotationIntrospector.findNamingStrategy(_classDef);
if (namingDef == null) {
return _config.getPropertyNamingStrategy();
}
if (namingDef instanceof PropertyNamingStrategy) {
return (PropertyNamingStrategy) namingDef;
}
/* Alas, there's no way to force return type of "either class
* X or Y" -- need to throw an exception after the fact
*/
if (!(namingDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned PropertyNamingStrategy definition of type "
+namingDef.getClass().getName()+"; expected type PropertyNamingStrategy or Class<PropertyNamingStrategy> instead");
}
Class<?> namingClass = (Class<?>)namingDef;
// 09-Nov-2015, tatu: Need to consider pseudo-value of STD, which means "use default"
if (namingClass == PropertyNamingStrategy.class) {
return null;
}
if (!PropertyNamingStrategy.class.isAssignableFrom(namingClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "
+namingClass.getName()+"; expected Class<PropertyNamingStrategy>");
}
HandlerInstantiator hi = _config.getHandlerInstantiator();
if (hi != null) {
PropertyNamingStrategy pns = hi.namingStrategyInstance(_config, _classDef, namingClass);
if (pns != null) {
return pns;
}
}
return (PropertyNamingStrategy) ClassUtil.createInstance(namingClass,
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> = src._setters;
_forSerialization = src._forSerialization;
}
/*
/**********************************************************
/* Fluent factory methods
/**********************************************************
*/
@Override
public POJOPropertyBuilder withName(PropertyName newName) {
return new POJOPropertyBuilder(this, newName);
}
@Override
public POJOPropertyBuilder withSimpleName(String newSimpleName)
{
PropertyName newName = _name.withSimpleName(newSimpleName);
return (newName == _name) ? this : new POJOPropertyBuilder(this, newName);
}
/*
/**********************************************************
/* Comparable implementation: sort alphabetically, except
/* that properties with constructor parameters sorted
/* before other properties
/**********************************************************
*/
@Override
public int compareTo(POJOPropertyBuilder other)
{
// first, if one has ctor params, that should come first:
if (_ctorParameters != null) {
if (other._ctorParameters == null) {
return -1;
}
} else if (other._ctorParameters != null) {
return 1;
}
/* otherwise sort by external name (including sorting of
* ctor parameters)
*/
return getName().compareTo(other.getName());
}
/*
/**********************************************************
/* BeanPropertyDefinition implementation, name/type
/**********************************************************
*/
@Override
public String getName() {
return (_name == null) ? null : _name.getSimpleName();
}
@Override
public PropertyName getFullName() {
return _name;
}
@Override
public boolean hasName(PropertyName name) {
return _name.equals(name);
}
@Override
public String getInternalName() { return _internalName.getSimpleName(); }
@Override
public PropertyName getWrapperName() {
/* 13-Mar-2013, tatu: Accessing via primary member SHOULD work,
* due to annotation merging. However, I have seen some problems
* with this access (for other annotations)... so if this should
* occur, try commenting out full traversal code
*/
AnnotatedMember member = getPrimaryMember();
return (member == null || _annotationIntrospector == null) ? null
: _annotationIntrospector.findWrapperName(member);
/*
return fromMemberAnnotations(
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> report exception if one
* is in super-class from the other
*/
Class<?> currClass = curr.value.getDeclaringClass();
Class<?> nextClass = next.value.getDeclaringClass();
if (currClass != nextClass) {
if (currClass.isAssignableFrom(nextClass)) { // next is more specific
curr = next;
continue;
}
if (nextClass.isAssignableFrom(currClass)) { // current more specific
continue;
}
}
/* 30-May-2014, tatu: Three levels of precedence:
*
* 1. Regular getters ("getX")
* 2. Is-getters ("isX")
* 3. Implicit, possible getters ("x")
*/
int priNext = _getterPriority(next.value);
int priCurr = _getterPriority(curr.value);
if (priNext != priCurr) {
if (priNext < priCurr) {
curr = next;
}
continue;
}
throw new IllegalArgumentException("Conflicting getter definitions for property \""+getName()+"\": "
+curr.value.getFullName()+" vs "+next.value.getFullName());
}
// One more thing; to avoid having to do it again...
_getters = curr.withoutNext();
return curr.value;
}
@Override
public AnnotatedMethod getSetter()
{
// Easy with zero or one getters...
Linked<AnnotatedMethod> curr = _setters;
if (curr == null) {
return null;
}
Linked<AnnotatedMethod> next = curr.next;
if (next == null) {
return curr.value;
}
// But if multiple, verify that they do not conflict...
for (; next != null; next = next.next) {
// Allow masking, i.e. do not fail if one is in super-class from the other
Class<?> currClass = curr.value.getDeclaringClass();
Class<?> nextClass = next.value.getDeclaringClass();
if (currClass != nextClass) {
if (currClass.isAssignableFrom(nextClass)) { // next is more specific
curr = next;
continue;
}
if (nextClass.isAssignableFrom(currClass)) { // current more specific
continue;
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
AnnotatedMethod nextM = next.value;
AnnotatedMethod currM = curr.value;
/* 30-May-2014, tatu: Two levels of precedence:
*
* 1. Regular setters ("setX(...)")
* 2. Implicit, possible setters ("x(...)")
*/
int priNext = _setterPriority(nextM);
int priCurr = _setterPriority(currM);
if (priNext != priCurr) {
if (priNext < priCurr) {
curr = next;
}
continue;
}
// 11-Dec-2015, tatu: As per [databind#1033] allow pluggable conflict resolution
if (_annotationIntrospector != null) {
AnnotatedMethod pref = _annotationIntrospector.resolveSetterConflict(_config,
currM, nextM);
// note: should be one of nextM/currM; but no need to check
if (pref == currM) {
continue;
}
if (pref == nextM) {
curr = next;
continue;
}
}
throw new IllegalArgumentException(String.format(
"Conflicting setter definitions for property \"%s\": %s vs %s",
getName(), curr.value.getFullName(), next.value.getFullName()));
}
// One more thing; to avoid having to do it again...
_setters = curr.withoutNext();
return curr.value;
}
@Override
public AnnotatedField getField()
{
if (_fields == null) {
return null;
}
// If multiple, verify that they do not conflict...
AnnotatedField field = _fields.value;
Linked<AnnotatedField> next = _fields.next;
for (; next != null; next = next.next) {
AnnotatedField nextField = next.value;
Class<?> fieldClass = field.getDeclaringClass();
Class<?> nextClass = nextField.getDeclaringClass();
if (fieldClass != nextClass) {
if (fieldClass.isAssignableFrom(nextClass)) { // next is more specific
field = nextField;
continue;
}
if (nextClass.isAssignableFrom(fieldClass)) { // getter more specific
continue;
}
}
throw
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> new IllegalArgumentException("Multiple fields representing property \""+getName()+"\": "
+field.getFullName()+" vs "+nextField.getFullName());
}
return field;
}
@Override
public AnnotatedParameter getConstructorParameter()
{
if (_ctorParameters == null) {
return null;
}
/* Hmmh. Checking for constructor parameters is trickier; for one,
* we must allow creator and factory method annotations.
* If this is the case, constructor parameter has the precedence.
*
* So, for now, just try finding the first constructor parameter;
* if none, first factory method. And don't check for dups, if we must,
* can start checking for them later on.
*/
Linked<AnnotatedParameter> curr = _ctorParameters;
do {
if (curr.value.getOwner() instanceof AnnotatedConstructor) {
return curr.value;
}
curr = curr.next;
} while (curr != null);
return _ctorParameters.value;
}
@Override
public Iterator<AnnotatedParameter> getConstructorParameters() {
if (_ctorParameters == null) {
return ClassUtil.emptyIterator();
}
return new MemberIterator<AnnotatedParameter>(_ctorParameters);
}
@Override
public AnnotatedMember getAccessor()
{
AnnotatedMember m = getGetter();
if (m == null) {
m = getField();
}
return m;
}
@Override
public AnnotatedMember getMutator()
{
AnnotatedMember m = getConstructorParameter();
if (m == null) {
m = getSetter();
if (m == null) {
m = getField();
}
}
return m;
}
@Override
public AnnotatedMember getNonConstructorMutator() {
AnnotatedMember m = getSetter();
if (m == null) {
m = getField();
}
return m;
}
@Override
public AnnotatedMember getPrimaryMember() {
if (_forSerialization) {
return getAccessor();
}
return getMutator();
}
protected int _getterPriority(AnnotatedMethod m)
{
final String name = m.getName();
// [databind#238]: Also, regular getters have precedence over "is-getters"
if (name.startsWith("get") && name
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.length() > 3) {
// should we check capitalization?
return 1;
}
if (name.startsWith("is") && name.length() > 2) {
return 2;
}
return 3;
}
protected int _setterPriority(AnnotatedMethod m)
{
final String name = m.getName();
if (name.startsWith("set") && name.length() > 3) {
// should we check capitalization?
return 1;
}
return 2;
}
/*
/**********************************************************
/* Implementations of refinement accessors
/**********************************************************
*/
@Override
public Class<?>[] findViews() {
return fromMemberAnnotations(new WithMember<Class<?>[]>() {
@Override
public Class<?>[] withMember(AnnotatedMember member) {
return _annotationIntrospector.findViews(member);
}
});
}
@Override
public AnnotationIntrospector.ReferenceProperty findReferenceType() {
return fromMemberAnnotations(new WithMember<AnnotationIntrospector.ReferenceProperty>() {
@Override
public AnnotationIntrospector.ReferenceProperty withMember(AnnotatedMember member) {
return _annotationIntrospector.findReferenceType(member);
}
});
}
@Override
public boolean isTypeId() {
Boolean b = fromMemberAnnotations(new WithMember<Boolean>() {
@Override
public Boolean withMember(AnnotatedMember member) {
return _annotationIntrospector.isTypeId(member);
}
});
return (b != null) && b.booleanValue();
}
@Override
public PropertyMetadata getMetadata() {
final Boolean b = _findRequired();
final String desc = _findDescription();
final Integer idx = _findIndex();
final String def = _findDefaultValue();
if (b == null && idx == null && def == null) {
return (desc == null) ? PropertyMetadata.STD_REQUIRED_OR_OPTIONAL
: PropertyMetadata.STD_REQUIRED_OR_OPTIONAL.withDescription(desc);
}
return PropertyMetadata.construct(b.booleanValue(), desc, idx, def);
}
protected Boolean _findRequired() {
return fromMemberAnnotations(new WithMember<Boolean>() {
@Override
public Boolean withMember(AnnotatedMember member) {
return _annotationIntros
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>2;
}
}
// 05-May-2016, tatu: Unlike most usage, this seems legit, so...
JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg);
if (cause != null) {
e.initCause(cause);
}
throw e;
// nothing to do here, yet? We'll fail anyway
}
JsonToken t = p.getCurrentToken();
// [databind#381]
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final T value = deserialize(p, ctxt);
if (p.nextToken() != JsonToken.END_ARRAY) {
handleMissingEndArrayForSingle(p, ctxt);
}
return value;
}
if (t == JsonToken.VALUE_EMBEDDED_OBJECT) {
// Trivial cases; null to null, instance of type itself returned as is
Object ob = p.getEmbeddedObject();
if (ob == null) {
return null;
}
if (_valueClass.isAssignableFrom(ob.getClass())) {
return (T) ob;
}
return _deserializeEmbedded(ob, ctxt);
}
return (T) ctxt.handleUnexpectedToken(_valueClass, p);
}
protected abstract T _deserialize(String value, DeserializationContext ctxt) throws IOException;
protected T _deserializeEmbedded(Object ob, DeserializationContext ctxt) throws IOException {
// default impl: error out
ctxt.reportMappingException("Don't know how to convert embedded Object of type %s into %s",
ob.getClass().getName(), _valueClass.getName());
return null;
}
protected T _deserializeFromEmptyString() throws IOException {
return null;
}
/*
/**********************************************************
/* A general-purpose implementation
/**********************************************************
*/
/**
* "Chameleon" deserializer that works on simple types that are deserialized
* from a simple String.
*
* @since 2.4
*/
public static class Std extends FromStringDeserializer<Object>
{
private static final long serialVersionUID = 1;
public final static int STD_FILE = 1;
public final static int STD_URL = 2
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> throw new IllegalStateException("Unsupported container type ("+value.getClass().getName()
+") when resolving reference '"+_referenceName+"'");
}
} else {
_backProperty.set(value, instance);
}
}
// and then the forward reference itself
return _managedProperty.setAndReturn(instance, value);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
* the same event as the one it pointed to upon call).
*<p>
* Note that this method is never called for JSON null literal,
* and thus deserializers need (and should) not check for it.
*
* @param p Parsed used for reading JSON content
* @param ctxt Context that can be used to access information about
* this deserialization activity.
*
* @return Deserialized value
*/
public abstract T deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException;
/**
* Alternate deserialization method (compared to the most commonly
* used, {@link #deserialize(JsonParser, DeserializationContext)}),
* which takes in initialized value instance, to be
* configured and/or populated by deserializer.
* Method is not necessarily used (or supported) by all types
* (it will not work for immutable types, for obvious reasons):
* most commonly it is used for Collections and Maps.
* It may be used both with "updating readers" (for POJOs) and
* when Collections and Maps use "getter as setter".
*<p>
* Default implementation just throws
* {@link UnsupportedOperationException}, to indicate that types
* that do not explicitly add support do not necessarily support
* update-existing-value operation (esp. immutable types)
*/
public T deserialize(JsonParser p, DeserializationContext ctxt, T intoValue)
throws IOException, JsonProcessingException
{
throw new UnsupportedOperationException("Can not update object of type "
+intoValue.getClass().getName()+" (by deserializer of type "+getClass().getName()+")");
}
/**
* Deserialization called when type being deserialized is defined to
* contain additional type identifier, to allow for correctly
* instantiating correct subtype. This can be due to annotation on
* type (or its supertype), or due to global settings without
* annotations.
*<p>
* Default implementation may work for some types, but ideally subclasses
* should not rely on current default implementation.
* Implementation is mostly provided to avoid compilation errors with older
* code.
*
* @param typeDeserializer Deserializer to use for handling type information
*/
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
throws IOException
{
// We could try
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> when deserializing from empty JSON Strings).
* Usually this is same as {@link #getNullValue} (which in turn
* is usually simply Java null), but it can be overridden
* for types. Or, if type should never be converted from empty
* String, method can also throw an exception.
*<p>
* Since version 2.6 (in which the context argument was added), call is
* expected to be made each and every time an empty value is needed.
*<p>
* Default implementation simple calls {@link #getNullValue} and
* returns value.
*
* @since 2.6 Added to replace earlier no-arguments variant
*/
public T getEmptyValue(DeserializationContext ctxt) throws JsonMappingException {
// Change the direction in 2.7
return getEmptyValue();
}
/**
* Accessor that can be used to check whether this deserializer
* is expecting to possibly get an Object Identifier value instead of full value
* serialization, and if so, should be able to resolve it to actual
* Object instance to return as deserialized value.
*<p>
* Default implementation returns null, as support can not be implemented
* generically. Some standard deserializers (most notably
* {@link com.fasterxml.jackson.databind.deser.BeanDeserializer})
* do implement this feature, and may return reader instance, depending on exact
* configuration of instance (which is based on type, and referring property).
*
* @return ObjectIdReader used for resolving possible Object Identifier
* value, instead of full value serialization, if deserializer can do that;
* null if no Object Id is expected.
*
* @since 2.0
*/
public ObjectIdReader getObjectIdReader() { return null; }
/**
* Method needed by {@link BeanDeserializerFactory} to properly link
* managed- and back-reference pairs.
*
* @since 2.2 (was moved out of <code>BeanDeserializerBase</code>)
*/
public SettableBeanProperty findBackReference(String refName)
{
throw new IllegalArgumentException("Can not handle managed/back reference '"+refName
+"': type: value deserializer of type "+getClass().getName()+" does not support them");
}
/*
/**********************************************************
/* Deprecated methods
/**********************************************************
*/
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>,T> converter,
JavaType delegateType, JsonDeserializer<?> delegateDeserializer)
{
super(delegateType);
_converter = converter;
_delegateType = delegateType;
_delegateDeserializer = (JsonDeserializer<Object>) delegateDeserializer;
}
/**
* @since 2.5
*/
protected StdDelegatingDeserializer(StdDelegatingDeserializer<T> src)
{
super(src);
_converter = src._converter;
_delegateType = src._delegateType;
_delegateDeserializer = src._delegateDeserializer;
}
/**
* Method used for creating resolved contextual instances. Must be
* overridden when sub-classing.
*/
protected StdDelegatingDeserializer<T> withDelegate(Converter<Object,T> converter,
JavaType delegateType, JsonDeserializer<?> delegateDeserializer)
{
if (getClass() != StdDelegatingDeserializer.class) {
throw new IllegalStateException("Sub-class "+getClass().getName()+" must override 'withDelegate'");
}
return new StdDelegatingDeserializer<T>(converter, delegateType, delegateDeserializer);
}
/*
/**********************************************************
/* Contextualization
/**********************************************************
*/
@Override
public void resolve(DeserializationContext ctxt)
throws JsonMappingException
{
if (_delegateDeserializer != null && _delegateDeserializer instanceof ResolvableDeserializer) {
((ResolvableDeserializer) _delegateDeserializer).resolve(ctxt);
}
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
throws JsonMappingException
{
// First: if already got serializer to delegate to, contextualize it:
if (_delegateDeserializer != null) {
JsonDeserializer<?> deser = ctxt.handleSecondaryContextualization(_delegateDeserializer,
property, _delegateType);
if (deser != _delegateDeserializer) {
return withDelegate(_converter, _delegateType, deser);
}
return this;
}
// Otherwise: figure out what is the fully generic delegate type, then find deserializer
JavaType delegateType = _converter.getInputType(ctxt.getTypeFactory());
return withDelegate(_converter, delegateType,
ctxt.findContextualValueDeserializer(delegateType, property));
}
/*
/**********************************************************
/* Accessors
/**********************************************************
*/
@Override
public JsonDeserializer<?> getDelegatee() {
return _delegateDeserializer;
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> try alternative approach if they have more information on
* exact usage and constraints.
*
* @since 2.6
*/
protected Object _handleIncompatibleUpdateValue(JsonParser p, DeserializationContext ctxt, Object intoValue)
throws IOException
{
throw new UnsupportedOperationException(String.format
("Can not update object of type %s (using deserializer for type %s)"
+intoValue.getClass().getName(), _delegateType));
}
/*
/**********************************************************
/* Overridable methods
/**********************************************************
*/
/**
* Method called to convert from "delegate value" (which was deserialized
* from JSON using standard Jackson deserializer for delegate type)
* into desired target type.
*<P>
* The default implementation uses configured {@link Converter} to do
* conversion.
*
* @param delegateValue
*
* @return Result of conversion
*/
protected T convertValue(Object delegateValue) {
return _converter.convert(delegateValue);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (_useRealPropertyDefaults && (defaultBean = getDefaultBean()) != null) {
// 07-Sep-2016, tatu: may also need to front-load access forcing now
if (prov.isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)) {
am.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
try {
valueToSuppress = am.getValue(defaultBean);
} catch (Exception e) {
_throwWrapped(e, propDef.getName(), defaultBean);
}
} else {
valueToSuppress = getDefaultValue(actualType);
suppressNulls = true;
}
if (valueToSuppress == null) {
suppressNulls = true;
} else {
if (valueToSuppress.getClass().isArray()) {
valueToSuppress = ArrayBuilders.getArrayComparator(valueToSuppress);
}
}
break;
case NON_ABSENT: // new with 2.6, to support Guava/JDK8 Optionals
// always suppress nulls
suppressNulls = true;
// and for referential types, also "empty", which in their case means "absent"
if (actualType.isReferenceType()) {
valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY;
}
break;
case NON_EMPTY:
// always suppress nulls
suppressNulls = true;
// but possibly also 'empty' values:
valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY;
break;
case NON_NULL:
suppressNulls = true;
// fall through
case ALWAYS: // default
default:
// we may still want to suppress empty collections, as per [JACKSON-254]:
if (actualType.isContainerType()
&& !_config.isEnabled(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS)) {
valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY;
}
break;
}
BeanPropertyWriter bpw = new BeanPropertyWriter(propDef,
am, _beanDesc.getClassAnnotations(), declaredType,
ser, typeSer, serializationType, suppressNulls, valueToSuppress);
// How about custom null serializer?
Object serDef = _annotationInt
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>rospector.findNullSerializer(am);
if (serDef != null) {
bpw.assignNullSerializer(prov.serializerInstance(am, serDef));
}
// And then, handling of unwrapping
NameTransformer unwrapper = _annotationIntrospector.findUnwrappingNameTransformer(am);
if (unwrapper != null) {
bpw = bpw.unwrappingWriter(unwrapper);
}
return bpw;
}
/*
/**********************************************************
/* Helper methods; annotation access
/**********************************************************
*/
/**
* Method that will try to determine statically defined type of property
* being serialized, based on annotations (for overrides), and alternatively
* declared type (if static typing for serialization is enabled).
* If neither can be used (no annotations, dynamic typing), returns null.
*/
protected JavaType findSerializationType(Annotated a, boolean useStaticTyping, JavaType declaredType)
throws JsonMappingException
{
JavaType secondary = _annotationIntrospector.refineSerializationType(_config, a, declaredType);
// 11-Oct-2015, tatu: As of 2.7, not 100% sure following checks are needed. But keeping
// for now, just in case
if (secondary != declaredType) {
Class<?> serClass = secondary.getRawClass();
// Must be a super type to be usable
Class<?> rawDeclared = declaredType.getRawClass();
if (serClass.isAssignableFrom(rawDeclared)) {
; // fine as is
} else {
/* 18-Nov-2010, tatu: Related to fixing [JACKSON-416], an issue with such
* check is that for deserialization more specific type makes sense;
* and for serialization more generic. But alas JAXB uses but a single
* annotation to do both... Hence, we must just discard type, as long as
* types are related
*/
if (!rawDeclared.isAssignableFrom(serClass)) {
throw new IllegalArgumentException("Illegal concrete-type annotation for method '"+a.getName()+"': class "+serClass.getName()+" not a super-type of (declared) class "+rawDeclared.getName());
}
/* 03-Dec-2010, tatu: Actually, ugh
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> _throwWrapped(Exception e, String propName, Object defaultBean)
{
Throwable t = e;
while (t.getCause() != null) {
t = t.getCause();
}
if (t instanceof Error) throw (Error) t;
if (t instanceof RuntimeException) throw (RuntimeException) t;
throw new IllegalArgumentException("Failed to get property '"+propName+"' of default "+defaultBean.getClass().getName()+" instance");
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Shape shape = (format == null) ? null : format.getShape();
if (shape == null) {
return null;
}
// i.e. "default", check dynamically
if (shape == Shape.ANY || shape == Shape.SCALAR) {
return null;
}
// 19-May-2016, tatu: also consider "natural" shape
if (shape == Shape.STRING || shape == Shape.NATURAL) {
return Boolean.FALSE;
}
// 01-Oct-2014, tatu: For convenience, consider "as-array" to also mean 'yes, use index')
if (shape.isNumeric() || (shape == Shape.ARRAY)) {
return Boolean.TRUE;
}
throw new IllegalArgumentException("Unsupported serialization shape ("+shape+") for Enum "+enumClass.getName()
+", not supported as "
+ (fromClass? "class" : "property")
+" annotation");
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> superClass, JavaType[] superInterfaces) {
return new MapType(rawType, bindings,
superClass, superInterfaces, _keyType, _valueType,
_valueHandler, _typeHandler, _asStatic);
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
@Override
public MapType withKeyTypeHandler(Object h)
{
return new MapType(_class, _bindings,
_superClass, _superInterfaces, _keyType.withTypeHandler(h), _valueType,
_valueHandler, _typeHandler, _asStatic);
}
@Override
public MapType withKeyValueHandler(Object h) {
return new MapType(_class, _bindings,
_superClass, _superInterfaces, _keyType.withValueHandler(h), _valueType,
_valueHandler, _typeHandler, _asStatic);
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override
public String toString()
{
return "[map type; class "+_class.getName()+", "+_keyType+" -> "+_valueType+"]";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.exc;
import java.util.*;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonMappingException;
/**
* Specialized {@link JsonMappingException} sub-class specifically used
* to indicate problems due to encountering a JSON property that could
* not be mapped to an Object property (via getter, constructor argument
* or field).
*/
public class UnrecognizedPropertyException
extends PropertyBindingException
{
private static final long serialVersionUID = 1L;
public UnrecognizedPropertyException(JsonParser p, String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
{
super(p, msg, loc, referringClass, propName, propertyIds);
}
/**
* @deprecated Since 2.7
*/
@Deprecated // since 2.7
public UnrecognizedPropertyException(String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
{
super(msg, loc, referringClass, propName, propertyIds);
}
/**
* Factory method used for constructing instances of this exception type.
*
* @param p Underlying parser used for reading input being used for data-binding
* @param fromObjectOrClass Reference to either instance of problematic type (
* if available), or if not, type itself
* @param propertyName Name of unrecognized property
* @param propertyIds (optional, null if not available) Set of properties that
* type would recognize, if completely known: null if set can not be determined.
*/
public static UnrecognizedPropertyException from(JsonParser p,
Object fromObjectOrClass, String propertyName,
Collection<Object> propertyIds)
{
if (fromObjectOrClass == null) {
throw new IllegalArgumentException();
}
Class<?> ref;
if (fromObjectOrClass instanceof Class<?>) {
ref = (Class<?>) fromObjectOrClass;
} else {
ref = fromObjectOrClass.getClass();
}
String msg = "Unrecognized field \""+propertyName+"\" (class "+ref.getName()+"), not marked as ignorable";
UnrecognizedPropertyException e = new
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Annotated ann, Object deserDef)
throws JsonMappingException
{
if (deserDef == null) {
return null;
}
JsonDeserializer<?> deser;
if (deserDef instanceof JsonDeserializer) {
deser = (JsonDeserializer<?>) deserDef;
} else {
/* Alas, there's no way to force return type of "either class
* X or Y" -- need to throw an exception after the fact
*/
if (!(deserDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned deserializer definition of type "+deserDef.getClass().getName()+"; expected type JsonDeserializer or Class<JsonDeserializer> instead");
}
Class<?> deserClass = (Class<?>)deserDef;
// there are some known "no class" markers to consider too:
if (deserClass == JsonDeserializer.None.class || ClassUtil.isBogusClass(deserClass)) {
return null;
}
if (!JsonDeserializer.class.isAssignableFrom(deserClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName()+"; expected Class<JsonDeserializer>");
}
HandlerInstantiator hi = _config.getHandlerInstantiator();
deser = (hi == null) ? null : hi.deserializerInstance(_config, ann, deserClass);
if (deser == null) {
deser = (JsonDeserializer<?>) ClassUtil.createInstance(deserClass,
_config.canOverrideAccessModifiers());
}
}
// First: need to resolve
if (deser instanceof ResolvableDeserializer) {
((ResolvableDeserializer) deser).resolve(this);
}
return (JsonDeserializer<Object>) deser;
}
@Override
public final KeyDeserializer keyDeserializerInstance(Annotated ann, Object deserDef)
throws JsonMappingException
{
if (deserDef == null) {
return null;
}
KeyDeserializer deser;
if (deserDef instanceof KeyDeserializer) {
deser = (KeyDeserializer) deserDef;
} else {
if (!(deserDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned key deserializer definition of type "
+deserDef.getClass().getName()
+"; expected type KeyDeserializer or Class<KeyDeserializer> instead");
}
Class<?> deserClass = (Class<?>)de
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>serDef;
// there are some known "no class" markers to consider too:
if (deserClass == KeyDeserializer.None.class || ClassUtil.isBogusClass(deserClass)) {
return null;
}
if (!KeyDeserializer.class.isAssignableFrom(deserClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName()
+"; expected Class<KeyDeserializer>");
}
HandlerInstantiator hi = _config.getHandlerInstantiator();
deser = (hi == null) ? null : hi.keyDeserializerInstance(_config, ann, deserClass);
if (deser == null) {
deser = (KeyDeserializer) ClassUtil.createInstance(deserClass,
_config.canOverrideAccessModifiers());
}
}
// First: need to resolve
if (deser instanceof ResolvableDeserializer) {
((ResolvableDeserializer) deser).resolve(this);
}
return deser;
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Fluent factory method used for constructing a blueprint instance
* with different factory
*/
public abstract DefaultDeserializationContext with(DeserializerFactory factory);
/**
* Method called to create actual usable per-deserialization
* context instance.
*/
public abstract DefaultDeserializationContext createInstance(
DeserializationConfig config, JsonParser jp, InjectableValues values);
/*
/**********************************************************
/* And then the concrete implementation class
/**********************************************************
*/
/**
* Actual full concrete implementation
*/
public final static class Impl extends DefaultDeserializationContext
{
private static final long serialVersionUID = 1L;
/**
* Default constructor for a blueprint object, which will use the standard
* {@link DeserializerCache}, given factory.
*/
public Impl(DeserializerFactory df) {
super(df, null);
}
protected Impl(Impl src,
DeserializationConfig config, JsonParser jp, InjectableValues values) {
super(src, config, jp, values);
}
protected Impl(Impl src) { super(src); }
protected Impl(Impl src, DeserializerFactory factory) {
super(src, factory);
}
@Override
public DefaultDeserializationContext copy() {
if (getClass() != Impl.class) {
return super.copy();
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> h) {
if (h == _valueHandler) {
return this;
}
return new ReferenceType(_class, _bindings,
_superClass, _superInterfaces, _referencedType, _anchorType,
h, _typeHandler,_asStatic);
}
@Override
public ReferenceType withContentValueHandler(Object h) {
if (h == _referencedType.<Object>getValueHandler()) {
return this;
}
JavaType refdType = _referencedType.withValueHandler(h);
return new ReferenceType(_class, _bindings,
_superClass, _superInterfaces, refdType, _anchorType,
_valueHandler, _typeHandler, _asStatic);
}
@Override
public ReferenceType withStaticTyping() {
if (_asStatic) {
return this;
}
return new ReferenceType(_class, _bindings, _superClass, _superInterfaces,
_referencedType.withStaticTyping(), _anchorType,
_valueHandler, _typeHandler, true);
}
@Override
public JavaType refine(Class<?> rawType, TypeBindings bindings,
JavaType superClass, JavaType[] superInterfaces) {
return new ReferenceType(rawType, _bindings,
superClass, superInterfaces, _referencedType, _anchorType,
_valueHandler, _typeHandler, _asStatic);
}
@Override
protected String buildCanonicalName()
{
StringBuilder sb = new StringBuilder();
sb.append(_class.getName());
sb.append('<');
sb.append(_referencedType.toCanonical());
return sb.toString();
}
/*
/**********************************************************
/* Narrow/widen
/**********************************************************
*/
@Override
@Deprecated // since 2.7
protected JavaType _narrow(Class<?> subclass)
{
// Should we check that there is a sub-class relationship?
return new ReferenceType(subclass, _bindings,
_superClass, _superInterfaces, _referencedType, _anchorType,
_valueHandler, _typeHandler, _asStatic);
}
/*
/**********************************************************
/* Public API overrides
/**********************************************************
*/
@Override
public JavaType getContentType() {
return _referencedType;
}
@Override
public JavaType getReferencedType() {
return _referencedType;
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> member;
_fullName = fullName;
_name = fullName.getSimpleName();
_metadata = (metadata == null) ? PropertyMetadata.STD_OPTIONAL: metadata;
_inclusion = inclusion;
}
/**
* @deprecated Since 2.5 Use variant that takes PropertyName
*/
@Deprecated
protected SimpleBeanPropertyDefinition(AnnotatedMember member, String name,
AnnotationIntrospector intr) {
this(member, new PropertyName(name), intr, null, EMPTY_INCLUDE);
}
/**
* @since 2.2
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member) {
return new SimpleBeanPropertyDefinition(member, PropertyName.construct(member.getName()),
(config == null) ? null : config.getAnnotationIntrospector(),
null, EMPTY_INCLUDE);
}
/**
* @deprecated Since 2.5
*/
@Deprecated
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, String name) {
return new SimpleBeanPropertyDefinition(member, PropertyName.construct(name),
(config == null) ? null : config.getAnnotationIntrospector(),
null, EMPTY_INCLUDE);
}
/**
* @since 2.5
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name) {
return construct(config, member, name, null, EMPTY_INCLUDE);
}
/**
* @since 2.5
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name, PropertyMetadata metadata,
JsonInclude.Include inclusion) {
return new SimpleBeanPropertyDefinition(member, name,
(config == null) ? null : config.getAnnotationIntrospector(),
metadata, inclusion);
}
/**
* @since 2.7
*/
public static SimpleBeanPropertyDefinition construct(MapperConfig<?> config,
AnnotatedMember member, PropertyName name, PropertyMetadata metadata,
JsonInclude.Value inclusion) {
return new SimpleBeanPropertyDefinition(member, name,
(config == null) ? null : config.getAnnotationIntrospector(),
metadata, inclusion);
}
/*
/**********************************************************
/* Fluent factories
/**********************************************************
*/
// Note
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>: removed from base class in 2.6; left here until 2.7
@Deprecated // since 2.3 (remove in 2.7)
public BeanPropertyDefinition withName(String newName) {
return withSimpleName(newName);
}
@Override
public BeanPropertyDefinition withSimpleName(String newName) {
if (_fullName.hasSimpleName(newName) && !_fullName.hasNamespace()) {
return this;
}
return new SimpleBeanPropertyDefinition(_member, new PropertyName(newName),
_introspector, _metadata, _inclusion);
}
@Override
public BeanPropertyDefinition withName(PropertyName newName) {
if (_fullName.equals(newName)) {
return this;
}
return new SimpleBeanPropertyDefinition(_member, newName,
_introspector, _metadata, _inclusion);
}
/**
* @since 2.5
*/
public BeanPropertyDefinition withMetadata(PropertyMetadata metadata) {
if (metadata.equals(_metadata)) {
return this;
}
return new SimpleBeanPropertyDefinition(_member, _fullName,
_introspector, metadata, _inclusion);
}
/**
* @since 2.5
*/
public BeanPropertyDefinition withInclusion(JsonInclude.Value inclusion) {
if (_inclusion == inclusion) {
return this;
}
return new SimpleBeanPropertyDefinition(_member, _fullName,
_introspector, _metadata, inclusion);
}
/*
/**********************************************************
/* Basic property information, name, type
/**********************************************************
*/
@Override
public String getName() { return _fullName.getSimpleName(); }
@Override
public PropertyName getFullName() { return _fullName; }
@Override
public boolean hasName(PropertyName name) {
return _fullName.equals(name);
}
@Override
public String getInternalName() { return getName(); }
@Override
public PropertyName getWrapperName() {
return ((_introspector == null) && (_member != null))
? null : _introspector.findWrapperName(_member);
}
// hmmh. what should we claim here?
@Override public boolean isExplicitlyIncluded() { return false; }
@Override public boolean isExplicitlyNamed() { return false; }
/**
*
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> properties, during
* construction of serializers and deserializers.
* Use with utmost care, if at all...
*
* @since 2.1
*/
public boolean removeProperty(String propName)
{
Iterator<BeanPropertyDefinition> it = _properties().iterator();
while (it.hasNext()) {
BeanPropertyDefinition prop = it.next();
if (prop.getName().equals(propName)) {
it.remove();
return true;
}
}
return false;
}
public boolean addProperty(BeanPropertyDefinition def)
{
// first: ensure we do not have such property
if (hasProperty(def.getFullName())) {
return false;
}
_properties().add(def);
return true;
}
/**
* @since 2.6
*/
public boolean hasProperty(PropertyName name) {
return findProperty(name) != null;
}
/**
* @since 2.6
*/
public BeanPropertyDefinition findProperty(PropertyName name)
{
for (BeanPropertyDefinition prop : _properties()) {
if (prop.hasName(name)) {
return prop;
}
}
return null;
}
/*
/**********************************************************
/* Simple accessors from BeanDescription
/**********************************************************
*/
@Override
public AnnotatedClass getClassInfo() { return _classInfo; }
@Override
public ObjectIdInfo getObjectIdInfo() { return _objectIdInfo; }
@Override
public List<BeanPropertyDefinition> findProperties() {
return _properties();
}
@Override
public AnnotatedMethod findJsonValueMethod() {
return (_propCollector == null) ? null
: _propCollector.getJsonValueMethod();
}
@Override
public Set<String> getIgnoredPropertyNames() {
Set<String> ign = (_propCollector == null) ? null
: _propCollector.getIgnoredPropertyNames();
if (ign == null) {
return Collections.emptySet();
}
return ign;
}
@Override
public boolean hasKnownClassAnnotations() {
return _classInfo.hasAnnotations();
}
@Override
public Annotations getClassAnnotations() {
return _classInfo.getAnnotations();
}
@Override
@Deprecated // since 2.7
public TypeBindings bindingsForBeanType() {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> return _type.getBindings();
}
@Override
@Deprecated // since 2.8
public JavaType resolveType(java.lang.reflect.Type jdkType) {
if (jdkType == null) {
return null;
}
return _config.getTypeFactory().constructType(jdkType, _type.getBindings());
}
@Override
public AnnotatedConstructor findDefaultConstructor() {
return _classInfo.getDefaultConstructor();
}
@Override
public AnnotatedMethod findAnySetter() throws IllegalArgumentException
{
AnnotatedMethod anySetter = (_propCollector == null) ? null
: _propCollector.getAnySetterMethod();
if (anySetter != null) {
/* Also, let's be somewhat strict on how field name is to be
* passed; String, Object make sense, others not
* so much.
*/
/* !!! 18-May-2009, tatu: how about enums? Can add support if
* requested; easy enough for devs to add support within
* method.
*/
Class<?> type = anySetter.getRawParameterType(0);
if (type != String.class && type != Object.class) {
throw new IllegalArgumentException("Invalid 'any-setter' annotation on method "+anySetter.getName()+"(): first argument not of type String or Object, but "+type.getName());
}
}
return anySetter;
}
@Override
public Map<Object, AnnotatedMember> findInjectables() {
if (_propCollector != null) {
return _propCollector.getInjectables();
}
return Collections.emptyMap();
}
@Override
public List<AnnotatedConstructor> getConstructors() {
return _classInfo.getConstructors();
}
@Override
public Object instantiateBean(boolean fixAccess) {
AnnotatedConstructor ac = _classInfo.getDefaultConstructor();
if (ac == null) {
return null;
}
if (fixAccess) {
ac.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
try {
return ac.getAnnotated().newInstance();
} catch (Exception e) {
Throwable t = e;
while (t.getCause() != null) {
t = t.getCause();
}
if (t
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> instanceof Error) throw (Error) t;
if (t instanceof RuntimeException) throw (RuntimeException) t;
throw new IllegalArgumentException("Failed to instantiate bean of type "+_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") "+t.getMessage(), t);
}
}
/*
/**********************************************************
/* Simple accessors, extended
/**********************************************************
*/
@Override
public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes) {
return _classInfo.findMethod(name, paramTypes);
}
/*
/**********************************************************
/* General per-class annotation introspection
/**********************************************************
*/
@Override
public JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue)
{
// 15-Apr-2016, tatu: Let's check both per-type defaults and annotations; per-type
// defaults having higher precedence, so start with that
if (_annotationIntrospector != null) {
JsonFormat.Value v = _annotationIntrospector.findFormat(_classInfo);
if (v != null) {
if (defValue == null) {
defValue = v;
} else {
defValue = defValue.withOverrides(v);
}
}
}
JsonFormat.Value v = _config.getDefaultPropertyFormat(_classInfo.getRawType());
if (v != null) {
if (defValue == null) {
defValue = v;
} else {
defValue = defValue.withOverrides(v);
}
}
return defValue;
}
/*
/**********************************************************
/* Introspection for serialization
/**********************************************************
*/
@Override
public Converter<Object,Object> findSerializationConverter()
{
if (_annotationIntrospector == null) {
return null;
}
return _createConverter(_annotationIntrospector.findSerializationConverter(_classInfo));
}
/**
* Method for determining whether null properties should be written
* out for a Bean of introspected type. This is based on global
* feature (lowest priority, passed as argument)
* and per-class annotation (highest priority).
*/
@Override
public JsonInclude.Value findPropertyInclusion(JsonInclude.Value defValue) {
if (_annotationIntrospector != null) {
Json
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Include.Value incl = _annotationIntrospector.findPropertyInclusion(_classInfo);
if (incl != null) {
return (defValue == null) ? incl : defValue.withOverrides(incl);
}
}
return defValue;
}
/**
* Method used to locate the method of introspected class that
* implements {@link com.fasterxml.jackson.annotation.JsonAnyGetter}.
* If no such method exists null is returned.
* If more than one are found, an exception is thrown.
*/
@Override
public AnnotatedMember findAnyGetter() throws IllegalArgumentException
{
AnnotatedMember anyGetter = (_propCollector == null) ? null
: _propCollector.getAnyGetter();
if (anyGetter != null) {
/* For now let's require a Map; in future can add support for other
* types like perhaps Iterable<Map.Entry>?
*/
Class<?> type = anyGetter.getRawType();
if (!Map.class.isAssignableFrom(type)) {
throw new IllegalArgumentException("Invalid 'any-getter' annotation on method "+anyGetter.getName()+"(): return type is not instance of java.util.Map");
}
}
return anyGetter;
}
@Override
public AnnotatedMember findAnySetterField() throws IllegalArgumentException {
AnnotatedMember anySetter = (_propCollector == null) ? null : _propCollector.getAnySetterField();
if (anySetter != null) {
/*
* For now let's require a Map; in future can add support for other
* types like perhaps Iterable<Map.Entry>?
*/
Class<?> type = anySetter.getRawType();
if (!Map.class.isAssignableFrom(type)) {
throw new IllegalArgumentException("Invalid 'any-setter' annotation on field " + anySetter.getName()
+ "(): type is not instance of java.util.Map");
}
}
return anySetter;
}
@Override
public Map<String,AnnotatedMember> findBackReferenceProperties()
{
HashMap<String,AnnotatedMember> result = null;
// boolean hasIgnored = (_ignoredPropertyNames != null);
for (BeanPropertyDefinition property : _properties()) {
/* 23-Sep-2014, tatu: As per [Databind#426
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>], we _should_ try to avoid
* calling accessor, as it triggers exception from seeming conflict.
* But the problem is that _ignoredPropertyNames here only contains
* ones ignored on per-property annotations, but NOT class annotations...
* so commented out part does not work, alas
*/
/*
if (hasIgnored && _ignoredPropertyNames.contains(property.getName())) {
continue;
}
*/
AnnotatedMember am = property.getMutator();
if (am == null) {
continue;
}
AnnotationIntrospector.ReferenceProperty refDef = _annotationIntrospector.findReferenceType(am);
if (refDef != null && refDef.isBackReference()) {
if (result == null) {
result = new HashMap<String,AnnotatedMember>();
}
String refName = refDef.getName();
if (result.put(refName, am) != null) {
throw new IllegalArgumentException("Multiple back-reference properties with name '"+refName+"'");
}
}
}
return result;
}
/*
/**********************************************************
/* Introspection for deserialization, factories
/**********************************************************
*/
@Override
public List<AnnotatedMethod> getFactoryMethods()
{
// must filter out anything that clearly is not a factory method
List<AnnotatedMethod> candidates = _classInfo.getStaticMethods();
if (candidates.isEmpty()) {
return candidates;
}
ArrayList<AnnotatedMethod> result = new ArrayList<AnnotatedMethod>();
for (AnnotatedMethod am : candidates) {
if (isFactoryMethod(am)) {
result.add(am);
}
}
return result;
}
@Override
public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
{
for (AnnotatedConstructor ac : _classInfo.getConstructors()) {
// This list is already filtered to only include accessible
/* (note: for now this is a redundant check; but in future
* that may change; thus leaving here for now)
*/
if (ac.getParameterCount() == 1) {
Class<?> actArg = ac.getRawParameterType(0);
for (Class<?> expArg : argTypes) {
if (expArg == actArg) {
return ac.getAnnotated();
}
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> return null;
}
@Override
public Method findFactoryMethod(Class<?>... expArgTypes)
{
// So, of all single-arg static methods:
for (AnnotatedMethod am : _classInfo.getStaticMethods()) {
// 24-Oct-2016, tatu: Better ensure it only takes 1 arg, no matter what
if (isFactoryMethod(am) && am.getParameterCount() == 1) {
// And must take one of expected arg types (or supertype)
Class<?> actualArgType = am.getRawParameterType(0);
for (Class<?> expArgType : expArgTypes) {
// And one that matches what we would pass in
if (actualArgType.isAssignableFrom(expArgType)) {
return am.getAnnotated();
}
}
}
}
return null;
}
protected boolean isFactoryMethod(AnnotatedMethod am)
{
/* First: return type must be compatible with the introspected class
* (i.e. allowed to be sub-class, although usually is the same class)
*/
Class<?> rt = am.getRawReturnType();
if (!getBeanClass().isAssignableFrom(rt)) {
return false;
}
/* Also: must be a recognized factory method, meaning:
* (a) marked with @JsonCreator annotation, or
* (b) "valueOf" (at this point, need not be public)
*/
if (_annotationIntrospector.hasCreatorAnnotation(am)) {
return true;
}
final String name = am.getName();
// 24-Oct-2016, tatu: As per [databind#1429] must ensure takes exactly one arg
if ("valueOf".equals(name)) {
if (am.getParameterCount() == 1) {
return true;
}
}
// [databind#208] Also accept "fromString()", if takes String or CharSequence
if ("fromString".equals(name)) {
if (am.getParameterCount() == 1) {
Class<?> cls = am.getRawParameterType(0);
if (cls == String.class || CharSequence.class.isAssignableFrom(cls)) {
return true;
}
}
}
return false;
}
/**
* @deprecated since 2.8
*/
@
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> {
AnnotatedField f = property.getField();
if (f != null) {
String name = property.getName();
if (ignoredProperties != null) {
if (ignoredProperties.contains(name)) {
continue;
}
}
results.put(name, f);
}
}
return results;
}
/*
/**********************************************************
/* Helper methods, other
/**********************************************************
*/
@SuppressWarnings("unchecked")
public Converter<Object,Object> _createConverter(Object converterDef)
{
if (converterDef == null) {
return null;
}
if (converterDef instanceof Converter<?,?>) {
return (Converter<Object,Object>) converterDef;
}
if (!(converterDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned Converter definition of type "
+converterDef.getClass().getName()+"; expected type Converter or Class<Converter> instead");
}
Class<?> converterClass = (Class<?>)converterDef;
// there are some known "no class" markers to consider too:
if (converterClass == Converter.None.class || ClassUtil.isBogusClass(converterClass)) {
return null;
}
if (!Converter.class.isAssignableFrom(converterClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "
+converterClass.getName()+"; expected Class<Converter>");
}
HandlerInstantiator hi = _config.getHandlerInstantiator();
Converter<?,?> conv = (hi == null) ? null : hi.converterInstance(_config, _classInfo, converterClass);
if (conv == null) {
conv = (Converter<?,?>) ClassUtil.createInstance(converterClass,
_config.canOverrideAccessModifiers());
}
return (Converter<Object,Object>) conv;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> instance.
*
* @param newName Name to use for the new instance.
*
* @return Newly constructed instance, if property name differs from the
* one used for this instance; or 'this' if not.
*/
public abstract SettableBeanProperty withName(PropertyName newName);
/**
* @since 2.3
*/
public SettableBeanProperty withSimpleName(String simpleName) {
PropertyName n = (_propName == null)
? new PropertyName(simpleName) : _propName.withSimpleName(simpleName);
return (n == _propName) ? this : withName(n);
}
@Deprecated // since 2.3 -- use 'withSimpleName' instead if need be
public SettableBeanProperty withName(String simpleName) {
return withName(new PropertyName(simpleName));
}
public void setManagedReferenceName(String n) {
_managedReferenceName = n;
}
public void setObjectIdInfo(ObjectIdInfo objectIdInfo) {
_objectIdInfo = objectIdInfo;
}
public void setViews(Class<?>[] views) {
if (views == null) {
_viewMatcher = null;
} else {
_viewMatcher = ViewMatcher.construct(views);
}
}
/**
* Method used to assign index for property.
*/
public void assignIndex(int index) {
if (_propertyIndex != -1) {
throw new IllegalStateException("Property '"+getName()+"' already had index ("+_propertyIndex+"), trying to assign "+index);
}
_propertyIndex = index;
}
/**
* Method called to ensure that the mutator has proper access rights to
* be called, as per configuration. Overridden by implementations that
* have mutators that require access, fields and setters.
*
* @since 2.8.3
*/
public void fixAccess(DeserializationConfig config) {
;
}
/*
/**********************************************************
/* BeanProperty impl
/**********************************************************
*/
@Override
public final String getName() {
return _propName.getSimpleName();
}
@Override
public PropertyName getFullName() {
return _propName;
}
@Override
public JavaType getType() { return _type; }
@Override
public PropertyName
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.format(
"Internal error: no creator index for property '%s' (of type %s)",
this.getName(), getClass().getName()));
}
/**
* Accessor for id of injectable value, if this bean property supports
* value injection.
*/
public Object getInjectableValueId() { return null; }
/*
/**********************************************************
/* Public API
/**********************************************************
*/
/**
* Method called to deserialize appropriate value, given parser (and
* context), and set it using appropriate mechanism.
* Pre-condition is that passed parser must point to the first token
* that should be consumed to produce the value (the only value for
* scalars, multiple for Objects and Arrays).
*/
public abstract void deserializeAndSet(JsonParser p,
DeserializationContext ctxt, Object instance) throws IOException;
/**
* Alternative to {@link #deserializeAndSet} that returns
* either return value of setter method called (if one is),
* or null to indicate that no return value is available.
* Mostly used to support Builder style deserialization.
*
* @since 2.0
*/
public abstract Object deserializeSetAndReturn(JsonParser p,
DeserializationContext ctxt, Object instance) throws IOException;
/**
* Method called to assign given value to this property, on
* specified Object.
*<p>
* Note: this is an optional operation, not supported by all
* implementations, creator-backed properties for example do not
* support this method.
*/
public abstract void set(Object instance, Object value) throws IOException;
/**
* Method called to assign given value to this property, on
* specified Object, and return whatever delegating accessor
* returned (if anything)
*<p>
* Note: this is an optional operation, not supported by all
* implementations, creator-backed properties for example do not
* support this method.
*/
public abstract Object setAndReturn(Object instance, Object value) throws IOException;
/**
* This method is needed by some specialized bean deserializers,
* and also called by some {@link #deserializeAndSet} implementations.
*<p>
* Pre-condition is that passed parser must point to the first token
* that should be consumed to produce the value (the only value for
* scalars, multiple for Objects
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> and Arrays).
*<p>
* Note that this method is final for performance reasons: to override
* functionality you must override other methods that call this method;
* this method should also not be called directly unless you really know
* what you are doing (and probably not even then).
*/
public final Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException
{
JsonToken t = p.getCurrentToken();
if (t == JsonToken.VALUE_NULL) {
return _valueDeserializer.getNullValue(ctxt);
}
if (_valueTypeDeserializer != null) {
return _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer);
}
return _valueDeserializer.deserialize(p, ctxt);
}
/*
/**********************************************************
/* Helper methods
/**********************************************************
*/
/**
* Method that takes in exception of any type, and casts or wraps it
* to an IOException or its subclass.
*/
protected void _throwAsIOE(JsonParser p, Exception e, Object value) throws IOException
{
if (e instanceof IllegalArgumentException) {
String actType = (value == null) ? "[NULL]" : value.getClass().getName();
StringBuilder msg = new StringBuilder("Problem deserializing property '").append(getName());
msg.append("' (expected type: ").append(getType());
msg.append("; actual type: ").append(actType).append(")");
String origMsg = e.getMessage();
if (origMsg != null) {
msg.append(", problem: ").append(origMsg);
} else {
msg.append(" (no error message provided)");
}
throw JsonMappingException.from(p, msg.toString(), e);
}
_throwAsIOE(p, e);
}
/**
* @since 2.7
*/
protected IOException _throwAsIOE(JsonParser p, Exception e) throws IOException
{
if (e instanceof IOException) {
throw (IOException) e;
}
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
// let's wrap the innermost problem
Throwable th = e;
while (th.getCause() != null) {
th = th.getCause();
}
throw JsonMappingException.from(p, th.getMessage(), th);
}
@
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Deprecated // since 2.7
protected IOException _throwAsIOE(Exception e) throws IOException {
return _throwAsIOE((JsonParser) null, e);
}
// 10-Oct-2015, tatu: _Should_ be deprecated, too, but its remaining
// callers can not actually provide a JsonParser
protected void _throwAsIOE(Exception e, Object value) throws IOException {
_throwAsIOE((JsonParser) null, e, value);
}
@Override public String toString() { return "[property '"+getName()+"']"; }
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
* Helper class needed to be able to efficiently access class
* member functions ({@link Method}s and {@link Constructor}s)
* in {@link java.util.Map}s.
*/
public final class MemberKey
{
final static Class<?>[] NO_CLASSES = new Class<?>[0];
final String _name;
final Class<?>[] _argTypes;
public MemberKey(Method m)
{
this(m.getName(), m.getParameterTypes());
}
public MemberKey(Constructor<?> ctor)
{
this("", ctor.getParameterTypes());
}
public MemberKey(String name, Class<?>[] argTypes)
{
_name = name;
_argTypes = (argTypes == null) ? NO_CLASSES : argTypes;
}
@Override
public String toString() {
return _name + "(" + _argTypes.length+"-args)";
}
@Override
public int hashCode()
{
return _name.hashCode() + _argTypes.length;
}
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
}
MemberKey other = (MemberKey) o;
if (!_name.equals(other._name)) {
return false;
}
Class<?>[] otherArgs = other._argTypes;
int len = _argTypes.length;
if (otherArgs.length != len) {
return false;
}
for (int i = 0; i < len; ++i) {
Class<?> type1 = otherArgs[i];
Class<?> type2 = _argTypes[i];
if (type1 == type2) {
continue;
}
/* 23-Feb-2009, tatu: Are there any cases where we would have to
* consider some narrowing conversions or such? For now let's
* assume exact type match is enough
*/
/* 07-Apr-2009, tatu: Indeed there are (see [JACKSON-
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> name = type.getName();
// Hibernate uses proxies heavily as well:
if (name.startsWith("net.sf.cglib.proxy.")
|| name.startsWith("org.hibernate.proxy.")) {
return true;
}
// Not one of known proxies, nope:
return false;
}
/**
* Helper method that checks if given class is a concrete one;
* that is, not an interface or abstract class.
*/
public static boolean isConcrete(Class<?> type)
{
int mod = type.getModifiers();
return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0;
}
public static boolean isConcrete(Member member)
{
int mod = member.getModifiers();
return (mod & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0;
}
public static boolean isCollectionMapOrArray(Class<?> type)
{
if (type.isArray()) return true;
if (Collection.class.isAssignableFrom(type)) return true;
if (Map.class.isAssignableFrom(type)) return true;
return false;
}
/*
/**********************************************************
/* Type name handling methods
/**********************************************************
*/
/**
* Helper method used to construct appropriate description
* when passed either type (Class) or an instance; in latter
* case, class of instance is to be used.
*/
public static String getClassDescription(Object classOrInstance)
{
if (classOrInstance == null) {
return "unknown";
}
Class<?> cls = (classOrInstance instanceof Class<?>) ?
(Class<?>) classOrInstance : classOrInstance.getClass();
return cls.getName();
}
/*
/**********************************************************
/* Class loading
/**********************************************************
*/
/**
* @deprecated Since 2.6, use method in {@link com.fasterxml.jackson.databind.type.TypeFactory}.
*/
@Deprecated
public static Class<?> findClass(String className) throws ClassNotFoundException
{
// [JACKSON-597]: support primitive types (and void)
if (className.indexOf('.') < 0) {
if ("int".equals(className)) return Integer.TYPE;
if ("long".equals(className)) return Long.TYPE;
if ("float".equals(className)) return Float.TYPE
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
/*
/**********************************************************
/* Instantiation
/**********************************************************
*/
/**
* Method that can be called to try to create an instantiate of
* specified type. Instantiation is done using default no-argument
* constructor.
*
* @param canFixAccess Whether it is possible to try to change access
* rights of the default constructor (in case it is not publicly
* accessible) or not.
*
* @throws IllegalArgumentException If instantiation fails for any reason;
* except for cases where constructor throws an unchecked exception
* (which will be passed as is)
*/
public static <T> T createInstance(Class<T> cls, boolean canFixAccess)
throws IllegalArgumentException
{
Constructor<T> ctor = findConstructor(cls, canFixAccess);
if (ctor == null) {
throw new IllegalArgumentException("Class "+cls.getName()+" has no default (no arg) constructor");
}
try {
return ctor.newInstance();
} catch (Exception e) {
ClassUtil.unwrapAndThrowAsIAE(e, "Failed to instantiate class "+cls.getName()+", problem: "+e.getMessage());
return null;
}
}
public static <T> Constructor<T> findConstructor(Class<T> cls, boolean canFixAccess)
throws IllegalArgumentException
{
try {
Constructor<T> ctor = cls.getDeclaredConstructor();
if (canFixAccess) {
checkAndFixAccess(ctor);
} else {
// Has to be public...
if (!Modifier.isPublic(ctor.getModifiers())) {
throw new IllegalArgumentException("Default constructor for "+cls.getName()+" is not accessible (non-public?): not allowed to try modify access via Reflection: can not instantiate type");
}
}
return ctor;
} catch (NoSuchMethodException e) {
;
} catch (Exception e) {
ClassUtil.unwrapAndThrowAsIAE(e, "Failed to find default constructor of class "+cls.getName()+", problem: "+e.getMessage());
}
return null;
}
/*
/**********************************************************
/* Primitive type support
/**********************************************************
*/
/**
* Helper method used to get default value for wrappers used for primitive types
* (0 for Integer etc)
*/
public static Object defaultValue(Class<?> cls)
{
if (
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>cls == Integer.TYPE) {
return Integer.valueOf(0);
}
if (cls == Long.TYPE) {
return Long.valueOf(0L);
}
if (cls == Boolean.TYPE) {
return Boolean.FALSE;
}
if (cls == Double.TYPE) {
return Double.valueOf(0.0);
}
if (cls == Float.TYPE) {
return Float.valueOf(0.0f);
}
if (cls == Byte.TYPE) {
return Byte.valueOf((byte) 0);
}
if (cls == Short.TYPE) {
return Short.valueOf((short) 0);
}
if (cls == Character.TYPE) {
return '\0';
}
throw new IllegalArgumentException("Class "+cls.getName()+" is not a primitive type");
}
/**
* Helper method for finding wrapper type for given primitive type (why isn't
* there one in JDK?)
*/
public static Class<?> wrapperType(Class<?> primitiveType)
{
if (primitiveType == Integer.TYPE) {
return Integer.class;
}
if (primitiveType == Long.TYPE) {
return Long.class;
}
if (primitiveType == Boolean.TYPE) {
return Boolean.class;
}
if (primitiveType == Double.TYPE) {
return Double.class;
}
if (primitiveType == Float.TYPE) {
return Float.class;
}
if (primitiveType == Byte.TYPE) {
return Byte.class;
}
if (primitiveType == Short.TYPE) {
return Short.class;
}
if (primitiveType == Character.TYPE) {
return Character.class;
}
throw new IllegalArgumentException("Class "+primitiveType.getName()+" is not a primitive type");
}
/**
* Method that can be used to find primitive type for given class if (but only if)
* it is either wrapper type or primitive type; returns `null` if type is neither.
*
* @since 2.7
*/
public static Class<?> primitiveType(Class<?> type)
{
if (type.isPrimitive()) {
return type;
}
if (type == Integer.class) {
return Integer.TYPE;
}
if (type == Long.class) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>SON-101]: this can fail on platforms like
// Google App Engine); so let's only fail if we really needed it...
if (!ao.isAccessible()) {
Class<?> declClass = member.getDeclaringClass();
throw new IllegalArgumentException("Can not access "+member+" (from class "+declClass.getName()+"; failed to set access: "+se.getMessage());
}
}
}
/*
/**********************************************************
/* Enum type detection
/**********************************************************
*/
/**
* Helper method that can be used to dynamically figure out
* enumeration type of given {@link EnumSet}, without having
* access to its declaration.
* Code is needed to work around design flaw in JDK.
*/
public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s)
{
// First things first: if not empty, easy to determine
if (!s.isEmpty()) {
return findEnumType(s.iterator().next());
}
// Otherwise need to locate using an internal field
return EnumTypeLocator.instance.enumTypeFor(s);
}
/**
* Helper method that can be used to dynamically figure out
* enumeration type of given {@link EnumSet}, without having
* access to its declaration.
* Code is needed to work around design flaw in JDK.
*/
public static Class<? extends Enum<?>> findEnumType(EnumMap<?,?> m)
{
if (!m.isEmpty()) {
return findEnumType(m.keySet().iterator().next());
}
// Otherwise need to locate using an internal field
return EnumTypeLocator.instance.enumTypeFor(m);
}
/**
* Helper method that can be used to dynamically figure out formal
* enumeration type (class) for given enumeration. This is either
* class of enum instance (for "simple" enumerations), or its
* superclass (for enums with instance fields or methods)
*/
@SuppressWarnings("unchecked")
public static Class<? extends Enum<?>> findEnumType(Enum<?> en)
{
// enums with "body" are sub-classes of the formal type
Class<?> ec = en.getClass();
if (ec.getSuperclass() != Enum.class) {
ec = ec.getSuperclass();
}
return (Class<? extends Enum<?>>) ec;
}
/**
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
* Helper method that can be used to dynamically figure out formal
* enumeration type (class) for given class of an enumeration value.
* This is either class of enum instance (for "simple" enumerations),
* or its superclass (for enums with instance fields or methods)
*/
@SuppressWarnings("unchecked")
public static Class<? extends Enum<?>> findEnumType(Class<?> cls)
{
// enums with "body" are sub-classes of the formal type
if (cls.getSuperclass() != Enum.class) {
cls = cls.getSuperclass();
}
return (Class<? extends Enum<?>>) cls;
}
/**
* A method that will look for the first Enum value annotated with the given Annotation.
* <p>
* If there's more than one value annotated, the first one found will be returned. Which one exactly is used is undetermined.
*
* @param enumClass The Enum class to scan for a value with the given annotation
* @param annotationClass The annotation to look for.
* @return the Enum value annotated with the given Annotation or {@code null} if none is found.
* @throws IllegalArgumentException if there's a reflection issue accessing the Enum
* @since 2.8
*/
public static <T extends Annotation> Enum<?> findFirstAnnotatedEnumValue(Class<Enum<?>> enumClass, Class<T> annotationClass)
{
Field[] fields = getDeclaredFields(enumClass);
for (Field field : fields) {
if (field.isEnumConstant()) {
Annotation defaultValueAnnotation = field.getAnnotation(annotationClass);
if (defaultValueAnnotation != null) {
final String name = field.getName();
for (Enum<?> enumValue : enumClass.getEnumConstants()) {
if (name.equals(enumValue.name())) {
return enumValue;
}
}
}
}
}
return null;
}
/*
/**********************************************************
/* Jackson-specific stuff
/**********************************************************
*/
/**
* Method that can be called to determine if given Object is the default
* implementation Jackson uses; as opposed to a custom serializer installed by
* a module or calling application. Determination is done using
* {@link JacksonStdImpl} annotation on handler (serializer, deserializer etc)
* class.
*/
public static boolean isJack
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>sonStdImpl(Object impl) {
return (impl != null) && isJacksonStdImpl(impl.getClass());
}
public static boolean isJacksonStdImpl(Class<?> implClass) {
return (implClass.getAnnotation(JacksonStdImpl.class) != null);
}
public static boolean isBogusClass(Class<?> cls) {
return (cls == Void.class || cls == Void.TYPE
|| cls == com.fasterxml.jackson.databind.annotation.NoClass.class);
}
public static boolean isNonStaticInnerClass(Class<?> cls) {
return !Modifier.isStatic(cls.getModifiers())
&& (getEnclosingClass(cls) != null);
}
/**
* @since 2.7
*/
public static boolean isObjectOrPrimitive(Class<?> cls) {
return (cls == CLS_OBJECT) || cls.isPrimitive();
}
/*
/**********************************************************
/* Access to various Class definition aspects; possibly
/* cacheable; and attempts was made in 2.7.0 - 2.7.7; however
/* unintented retention (~= memory leak) wrt [databind#1363]
/* resulted in removal of caching
/**********************************************************
*/
/**
* @since 2.7
*/
public static String getPackageName(Class<?> cls) {
Package pkg = cls.getPackage();
return (pkg == null) ? null : pkg.getName();
}
/**
* @since 2.7
*/
public static boolean hasEnclosingMethod(Class<?> cls) {
return !isObjectOrPrimitive(cls) && (cls.getEnclosingMethod() != null);
}
/**
* @since 2.7
*/
public static Field[] getDeclaredFields(Class<?> cls) {
return cls.getDeclaredFields();
}
/**
* @since 2.7
*/
public static Method[] getDeclaredMethods(Class<?> cls) {
return cls.getDeclaredMethods();
}
/**
* @since 2.7
*/
public static Annotation[] findClassAnnotations(Class<?> cls) {
if (isObjectOrPrimitive(cls)) {
return NO_ANNOTATIONS;
}
return cls.getDeclaredAnnotations();
}
/**
* @since 2.7
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
enumSetTypeField = locateField(EnumSet.class, "elementType", Class.class);
enumMapTypeField = locateField(EnumMap.class, "elementType", Class.class);
}
@SuppressWarnings("unchecked")
public Class<? extends Enum<?>> enumTypeFor(EnumSet<?> set)
{
if (enumSetTypeField != null) {
return (Class<? extends Enum<?>>) get(set, enumSetTypeField);
}
throw new IllegalStateException("Can not figure out type for EnumSet (odd JDK platform?)");
}
@SuppressWarnings("unchecked")
public Class<? extends Enum<?>> enumTypeFor(EnumMap<?,?> set)
{
if (enumMapTypeField != null) {
return (Class<? extends Enum<?>>) get(set, enumMapTypeField);
}
throw new IllegalStateException("Can not figure out type for EnumMap (odd JDK platform?)");
}
private Object get(Object bean, Field field)
{
try {
return field.get(bean);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
private static Field locateField(Class<?> fromClass, String expectedName, Class<?> type)
{
Field found = null;
// First: let's see if we can find exact match:
Field[] fields = getDeclaredFields(fromClass);
for (Field f : fields) {
if (expectedName.equals(f.getName()) && f.getType() == type) {
found = f;
break;
}
}
// And if not, if there is just one field with the type, that field
if (found == null) {
for (Field f : fields) {
if (f.getType() == type) {
// If more than one, can't choose
if (found != null) return null;
found = f;
}
}
}
if (found != null) { // it's non-public, need to force accessible
try {
found.setAccessible(true);
} catch (Throwable t) { }
}
return found;
}
}
/*
/**********************************************************
/* Helper classed used for caching
/**********************************************************
*/
/**
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
MapperConfig<?> config,
Set<Class<?>> typesHandled, Map<String,NamedType> byName)
{
final AnnotationIntrospector ai = config.getAnnotationIntrospector();
if (!namedType.hasName()) {
String name = ai.findTypeName(annotatedType);
if (name != null) {
namedType = new NamedType(namedType.getType(), name);
}
}
if (namedType.hasName()) {
byName.put(namedType.getName(), namedType);
}
// only check subtypes if this type hadn't yet been handled
if (typesHandled.add(namedType.getType())) {
Collection<NamedType> st = ai.findSubtypes(annotatedType);
if (st != null && !st.isEmpty()) {
for (NamedType subtype : st) {
AnnotatedClass subtypeClass = AnnotatedClass.constructWithoutSuperTypes(subtype.getType(), config);
_collectAndResolveByTypeId(subtypeClass, subtype, config, typesHandled, byName);
}
}
}
}
/**
* Helper method used for merging explicitly named types and handled classes
* without explicit names.
*/
protected Collection<NamedType> _combineNamedAndUnnamed(Set<Class<?>> typesHandled,
Map<String,NamedType> byName)
{
ArrayList<NamedType> result = new ArrayList<NamedType>(byName.values());
// Ok, so... we will figure out which classes have no explicitly assigned name,
// by removing Classes from Set. And for remaining classes, add an anonymous
// marker
for (NamedType t : byName.values()) {
typesHandled.remove(t.getType());
}
for (Class<?> cls : typesHandled) {
result.add(new NamedType(cls));
}
return result;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>+SAMPLE_SPEC_VALUE_TN_ID4+"]\n"
+" }"
+"}"
;
/*
/**********************************************************
/* Helper classes (beans)
/**********************************************************
*/
/**
* Sample class from Jackson tutorial ("JacksonInFiveMinutes")
*/
protected static class FiveMinuteUser {
public enum Gender { MALE, FEMALE };
public static class Name
{
private String _first, _last;
public Name() { }
public Name(String f, String l) {
_first = f;
_last = l;
}
public String getFirst() { return _first; }
public String getLast() { return _last; }
public void setFirst(String s) { _first = s; }
public void setLast(String s) { _last = s; }
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
Name other = (Name) o;
return _first.equals(other._first) && _last.equals(other._last);
}
}
private Gender _gender;
private Name _name;
private boolean _isVerified;
private byte[] _userImage;
public FiveMinuteUser() { }
public FiveMinuteUser(String first, String last, boolean verified, Gender g, byte[] data)
{
_name = new Name(first, last);
_isVerified = verified;
_gender = g;
_userImage = data;
}
public Name getName() { return _name; }
public boolean isVerified() { return _isVerified; }
public Gender getGender() { return _gender; }
public byte[] getUserImage() { return _userImage; }
public void setName(Name n) { _name = n; }
public void setVerified(boolean b) { _isVerified = b; }
public void setGender(Gender g) { _gender = g; }
public void setUserImage(byte[] b) { _userImage = b; }
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> IOException
{
/* 23-Apr-2008, tatus: UTF-32 is not supported by JDK, have to
* use our own codec too (which is not optimal since there's
* a chance both encoder and decoder might have bugs, but ones
* that cancel each other out or such)
*/
byte[] data;
if (encoding.equalsIgnoreCase("UTF-32")) {
data = encodeInUTF32BE(input);
} else {
data = input.getBytes(encoding);
}
InputStream is = new ByteArrayInputStream(data);
return f.createParser(is);
}
/*
/**********************************************************
/* Additional assertion methods
/**********************************************************
*/
protected void assertToken(JsonToken expToken, JsonToken actToken)
{
if (actToken != expToken) {
fail("Expected token "+expToken+", current token "+actToken);
}
}
protected void assertToken(JsonToken expToken, JsonParser jp)
{
assertToken(expToken, jp.getCurrentToken());
}
protected void assertType(Object ob, Class<?> expType)
{
if (ob == null) {
fail("Expected an object of type "+expType.getName()+", got null");
}
Class<?> cls = ob.getClass();
if (!expType.isAssignableFrom(cls)) {
fail("Expected type "+expType.getName()+", got "+cls.getName());
}
}
protected void assertValidLocation(JsonLocation location) {
assertNotNull("Should have non-null location", location);
assertTrue("Should have positive line number", location.getLineNr() > 0);
}
protected void verifyException(Throwable e, String... matches)
{
String msg = e.getMessage();
String lmsg = (msg == null) ? "" : msg.toLowerCase();
for (String match : matches) {
String lmatch = match.toLowerCase();
if (lmsg.indexOf(lmatch) >= 0) {
return;
}
}
fail("Expected an exception with one of substrings ("+Arrays.asList(matches)+"): got one with message \""+msg+"\"");
}
/**
* Method that gets textual contents of the current token using
* available methods, and ensures results are consistent, before
* returning them
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> type.
*
* @param type Type to generate schema for (possibly with generic signature)
*
* @since 2.2
*/
public void acceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor) throws JsonMappingException
{
if (type == null) {
throw new IllegalArgumentException("type must be provided");
}
_serializerProvider().acceptJsonFormatVisitor(type, visitor);
}
/**
* Since 2.6
*/
public void acceptJsonFormatVisitor(Class<?> rawType, JsonFormatVisitorWrapper visitor) throws JsonMappingException {
acceptJsonFormatVisitor(_config.constructType(rawType), visitor);
}
public boolean canSerialize(Class<?> type) {
return _serializerProvider().hasSerializerFor(type, null);
}
/**
* Method for checking whether instances of given type can be serialized,
* and optionally why (as per {@link Throwable} returned).
*
* @since 2.3
*/
public boolean canSerialize(Class<?> type, AtomicReference<Throwable> cause) {
return _serializerProvider().hasSerializerFor(type, cause);
}
/*
/**********************************************************
/* Overridable helper methods
/**********************************************************
*/
/**
* Overridable helper method used for constructing
* {@link SerializerProvider} to use for serialization.
*/
protected DefaultSerializerProvider _serializerProvider() {
return _serializerProvider.createInstance(_config, _serializerFactory);
}
/*
/**********************************************************
/* Internal methods
/**********************************************************
*/
/**
* @since 2.2
*/
protected void _verifySchemaType(FormatSchema schema)
{
if (schema != null) {
if (!_generatorFactory.canUseSchema(schema)) {
throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName()
+" for format "+_generatorFactory.getFormatName());
}
}
}
/**
* Method called to configure the generator as necessary and then
* call write functionality
*/
protected final void _configAndWriteValue(JsonGenerator gen, Object value) throws IOException
{
_configureGenerator(gen);
if (_config.isEnabled(SerializationFeature.CLOSE_CLOSEABLE) && (value instanceof Closeable)) {
_writeCloseable(gen, value);
return;
}
try
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
_anySetter = src._anySetter;
_injectables = src._injectables;
_objectIdReader = src._objectIdReader;
_nonStandardCreation = src._nonStandardCreation;
_unwrappedPropertyHandler = src._unwrappedPropertyHandler;
_needViewProcesing = src._needViewProcesing;
_serializationShape = src._serializationShape;
_vanillaProcessing = src._vanillaProcessing;
}
@Override
public abstract JsonDeserializer<Object> unwrappingDeserializer(NameTransformer unwrapper);
public abstract BeanDeserializerBase withObjectIdReader(ObjectIdReader oir);
public abstract BeanDeserializerBase withIgnorableProperties(Set<String> ignorableProps);
/**
* Mutant factory method that custom sub-classes must override; not left as
* abstract to prevent more drastic backwards compatibility problems.
*
* @since 2.8
*/
public BeanDeserializerBase withBeanProperties(BeanPropertyMap props) {
throw new UnsupportedOperationException("Class "+getClass().getName()
+" does not override `withBeanProperties()`, needs to");
}
/**
* Fluent factory for creating a variant that can handle
* POJO output as a JSON Array. Implementations may ignore this request
* if no such input is possible.
*
* @since 2.1
*/
protected abstract BeanDeserializerBase asArrayDeserializer();
/*
/**********************************************************
/* Validation, post-processing
/**********************************************************
*/
/**
* Method called to finalize setup of this deserializer,
* after deserializer itself has been registered.
* This is needed to handle recursive and transitive dependencies.
*/
@Override
public void resolve(DeserializationContext ctxt)
throws JsonMappingException
{
ExternalTypeHandler.Builder extTypes = null;
// if ValueInstantiator can use "creator" approach, need to resolve it here...
SettableBeanProperty[] creatorProps;
if (_valueInstantiator.canCreateFromObjectWith()) {
creatorProps = _valueInstantiator.getFromObjectArguments(ctxt.getConfig());
// 21-Jun-2015, tatu: This resolution was duplicated later on and seems like
// it really should be only done at a later point. So commented out in 2.8.
// However, just in case there was a reason for it, leaving commented out
//
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (_valueInstantiator.canCreateUsingDelegate()) {
JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid delegate-creator definition for "+_beanType
+": value instantiator ("+_valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'");
}
_delegateDeserializer = _findDelegateDeserializer(ctxt, delegateType,
_valueInstantiator.getDelegateCreator());
}
// and array-delegate-based constructor:
if (_valueInstantiator.canCreateUsingArrayDelegate()) {
JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid array-delegate-creator definition for "+_beanType
+": value instantiator ("+_valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingArrayDelegate()', but null for 'getArrayDelegateType()'");
}
_arrayDelegateDeserializer = _findDelegateDeserializer(ctxt, delegateType,
_valueInstantiator.getArrayDelegateCreator());
}
// And now that we know CreatorProperty instances are also resolved can finally create the creator:
if (creatorProps != null) {
_propertyBasedCreator = PropertyBasedCreator.construct(ctxt, _valueInstantiator, creatorProps);
}
if (extTypes != null) {
// 21-Jun-2016, tatu: related to [databind#999], may need to link type ids too,
// so need to pass collected properties
_externalTypeIdHandler = extTypes.build(_beanProperties);
// we consider this non-standard, to offline handling
_nonStandardCreation = true;
}
_unwrappedPropertyHandler = unwrapped;
if (unwrapped != null) { // we consider this non-standard, to offline handling
_nonStandardCreation = true;
}
// may need to disable vanilla processing, if unwrapped handling was enabled...
_vanillaProcessing = _vanillaProcessing && !_nonStandardCreation;
}
private JsonDeserializer<Object> _findDelegateDeserializer(DeserializationContext ctxt, JavaType delegateType,
AnnotatedWithParams delegateCreator) throws JsonMapping
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> AnnotatedMember accessor = (property == null || intr == null)
? null : property.getMember();
if (accessor != null && intr != null) {
ObjectIdInfo objectIdInfo = intr.findObjectIdInfo(accessor);
if (objectIdInfo != null) { // some code duplication here as well (from BeanDeserializerFactory)
// 2.1: allow modifications by "id ref" annotations as well:
objectIdInfo = intr.findObjectReferenceInfo(accessor, objectIdInfo);
Class<?> implClass = objectIdInfo.getGeneratorType();
// Property-based generator is trickier
JavaType idType;
SettableBeanProperty idProp;
ObjectIdGenerator<?> idGen;
ObjectIdResolver resolver = ctxt.objectIdResolverInstance(accessor, objectIdInfo);
if (implClass == ObjectIdGenerators.PropertyGenerator.class) {
PropertyName propName = objectIdInfo.getPropertyName();
idProp = findProperty(propName);
if (idProp == null) {
throw new IllegalArgumentException("Invalid Object Id definition for "
+handledType().getName()+": can not find property with name '"+propName+"'");
}
idType = idProp.getType();
idGen = new PropertyBasedObjectIdGenerator(objectIdInfo.getScope());
} else { // other types need to be simpler
JavaType type = ctxt.constructType(implClass);
idType = ctxt.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0];
idProp = null;
idGen = ctxt.objectIdGeneratorInstance(accessor, objectIdInfo);
}
JsonDeserializer<?> deser = ctxt.findRootValueDeserializer(idType);
oir = ObjectIdReader.construct(idType, objectIdInfo.getPropertyName(),
idGen, deser, idProp, resolver);
}
}
// either way, need to resolve serializer:
BeanDeserializerBase contextual = this;
if (oir != null && oir != _objectIdReader) {
contextual = contextual.withObjectIdReader(oir);
}
// And possibly add more properties to ignore
if (accessor != null) {
JsonIgnoreProperties.Value ignorals = intr.findPropertyIgnorals(accessor);
if (ignorals != null) {
Set<String> ignored = ignorals.findIgnoredForDeserialization
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.getType();
boolean isContainer = prop.getType().isContainerType();
if (!backRefType.getRawClass().isAssignableFrom(referredType.getRawClass())) {
throw new IllegalArgumentException("Can not handle managed/back reference '"+refName+"': back reference type ("
+backRefType.getRawClass().getName()+") not compatible with managed type ("
+referredType.getRawClass().getName()+")");
}
return new ManagedReferenceProperty(prop, refName, backProp,
_classAnnotations, isContainer);
}
/**
* Method that wraps given property with {@link ObjectIdReferenceProperty}
* in case where object id resolution is required.
*/
protected SettableBeanProperty _resolvedObjectIdProperty(DeserializationContext ctxt,
SettableBeanProperty prop) throws JsonMappingException
{
ObjectIdInfo objectIdInfo = prop.getObjectIdInfo();
JsonDeserializer<Object> valueDeser = prop.getValueDeserializer();
ObjectIdReader objectIdReader = valueDeser.getObjectIdReader();
if (objectIdInfo == null && objectIdReader == null) {
return prop;
}
return new ObjectIdReferenceProperty(prop, objectIdInfo);
}
/**
* Helper method called to see if given property might be so-called unwrapped
* property: these require special handling.
*/
protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationContext ctxt,
SettableBeanProperty prop)
{
AnnotatedMember am = prop.getMember();
if (am != null) {
NameTransformer unwrapper = ctxt.getAnnotationIntrospector().findUnwrappingNameTransformer(am);
if (unwrapper != null) {
JsonDeserializer<Object> orig = prop.getValueDeserializer();
JsonDeserializer<Object> unwrapping = orig.unwrappingDeserializer(unwrapper);
if (unwrapping != orig && unwrapping != null) {
// might be cleaner to create new instance; but difficult to do reliably, so:
return prop.withValueDeserializer(unwrapping);
}
}
}
return null;
}
/**
* Helper method that will handle gruesome details of dealing with properties
* that have non-static inner class as value...
*/
protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationContext ctxt,
SettableBeanProperty prop)
{
/* Should we encounter a property that has non
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Override
public Collection<Object> getKnownPropertyNames() {
ArrayList<Object> names = new ArrayList<Object>();
for (SettableBeanProperty prop : _beanProperties) {
names.add(prop.getName());
}
return names;
}
/**
* @deprecated Since 2.3, use {@link #handledType()} instead
*/
@Deprecated
public final Class<?> getBeanClass() { return _beanType.getRawClass(); }
@Override
public JavaType getValueType() { return _beanType; }
/**
* Accessor for iterating over properties this deserializer uses; with
* the exception that properties passed via Creator methods
* (specifically, "property-based constructor") are not included,
* but can be accessed separate by calling
* {@link #creatorProperties}
*/
public Iterator<SettableBeanProperty> properties()
{
if (_beanProperties == null) {
throw new IllegalStateException("Can only call after BeanDeserializer has been resolved");
}
return _beanProperties.iterator();
}
/**
* Accessor for finding properties that represents values to pass
* through property-based creator method (constructor or
* factory method)
*
* @since 2.0
*/
public Iterator<SettableBeanProperty> creatorProperties()
{
if (_propertyBasedCreator == null) {
return Collections.<SettableBeanProperty>emptyList().iterator();
}
return _propertyBasedCreator.properties().iterator();
}
public SettableBeanProperty findProperty(PropertyName propertyName)
{
// TODO: start matching full name?
return findProperty(propertyName.getSimpleName());
}
/**
* Accessor for finding the property with given name, if POJO
* has one. Name used is the external name, i.e. name used
* in external data representation (JSON).
*
* @since 2.0
*/
public SettableBeanProperty findProperty(String propertyName)
{
SettableBeanProperty prop = (_beanProperties == null) ?
null : _beanProperties.find(propertyName);
if (prop == null && _propertyBasedCreator != null) {
prop = _propertyBasedCreator.findCreatorProperty(propertyName);
}
return prop;
}
/**
* Alternate find method that tries to locate a property with given
* <code>
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.deser.std;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import com.fasterxml.jackson.databind.*;
/**
* Container class that contains serializers for JDK types that
* require special handling for some reason.
*/
public class JdkDeserializers
{
private final static HashSet<String> _classNames = new HashSet<String>();
static {
// note: can skip primitive types; other ways to check them:
Class<?>[] types = new Class<?>[] {
UUID.class,
AtomicBoolean.class,
StackTraceElement.class,
ByteBuffer.class
};
for (Class<?> cls : types) { _classNames.add(cls.getName()); }
for (Class<?> cls : FromStringDeserializer.types()) { _classNames.add(cls.getName()); }
}
public static JsonDeserializer<?> find(Class<?> rawType, String clsName)
{
if (_classNames.contains(clsName)) {
JsonDeserializer<?> d = FromStringDeserializer.findDeserializer(rawType);
if (d != null) {
return d;
}
if (rawType == UUID.class) {
return new UUIDDeserializer();
}
if (rawType == StackTraceElement.class) {
return new StackTraceElementDeserializer();
}
if (rawType == AtomicBoolean.class) {
// (note: AtomicInteger/Long work due to single-arg constructor. For now?
return new AtomicBooleanDeserializer();
}
if (rawType == ByteBuffer.class) {
return new ByteBufferDeserializer();
}
}
return null;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>fasterxml.jackson.databind.ext.DOMDeserializer$NodeDeserializer";
// // Since 2.7, we will assume DOM classes are always found, both due to JDK 1.6 minimum
// // and because Android (and presumably GAE) have these classes
private final static Class<?> CLASS_DOM_NODE;
private final static Class<?> CLASS_DOM_DOCUMENT;
static {
Class<?> doc = null, node = null;
try {
node = org.w3c.dom.Node.class;
doc = org.w3c.dom.Document.class;
} catch (Exception e) {
// not optimal but will do
System.err.println("WARNING: could not load DOM Node and/or Document classes");
}
CLASS_DOM_NODE = node;
CLASS_DOM_DOCUMENT = doc;
}
// // But Java7 type(s) may or may not be; dynamic lookup should be fine, still
// // (note: also assume it comes from JDK so that ClassLoader issues with OSGi
// // can, I hope, be avoided?)
private static final Java7Support _jdk7Helper;
static {
Java7Support x = null;
try {
x = Java7Support.instance();
} catch (Throwable t) { }
_jdk7Helper = x;
}
public final static OptionalHandlerFactory instance = new OptionalHandlerFactory();
protected OptionalHandlerFactory() { }
/*
/**********************************************************
/* Public API
/**********************************************************
*/
public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type,
BeanDescription beanDesc)
{
final Class<?> rawType = type.getRawClass();
if (_jdk7Helper != null) {
JsonSerializer<?> ser = _jdk7Helper.getSerializerForJavaNioFilePath(rawType);
if (ser != null) {
return ser;
}
}
if ((CLASS_DOM_NODE != null) && CLASS_DOM_NODE.isAssignableFrom(rawType)) {
return (JsonSerializer<?>) instantiate(SERIALIZER_FOR_DOM_NODE);
}
String className = rawType.getName();
String factoryName;
if (className.startsWith(PACKAGE_PREFIX_JAVAX_XML) || hasSuperClassStartingWith(rawType, PACKAGE_PREFIX_JAVAX_XML
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>)) {
factoryName = SERIALIZERS_FOR_JAVAX_XML;
} else {
return null;
}
Object ob = instantiate(factoryName);
if (ob == null) { // could warn, if we had logging system (j.u.l?)
return null;
}
return ((Serializers) ob).findSerializer(config, type, beanDesc);
}
public JsonDeserializer<?> findDeserializer(JavaType type, DeserializationConfig config,
BeanDescription beanDesc)
throws JsonMappingException
{
final Class<?> rawType = type.getRawClass();
if (_jdk7Helper != null) {
JsonDeserializer<?> deser = _jdk7Helper.getDeserializerForJavaNioFilePath(rawType);
if (deser != null) {
return deser;
}
}
if ((CLASS_DOM_NODE != null) && CLASS_DOM_NODE.isAssignableFrom(rawType)) {
return (JsonDeserializer<?>) instantiate(DESERIALIZER_FOR_DOM_NODE);
}
if ((CLASS_DOM_DOCUMENT != null) && CLASS_DOM_DOCUMENT.isAssignableFrom(rawType)) {
return (JsonDeserializer<?>) instantiate(DESERIALIZER_FOR_DOM_DOCUMENT);
}
String className = rawType.getName();
String factoryName;
if (className.startsWith(PACKAGE_PREFIX_JAVAX_XML)
|| hasSuperClassStartingWith(rawType, PACKAGE_PREFIX_JAVAX_XML)) {
factoryName = DESERIALIZERS_FOR_JAVAX_XML;
} else {
return null;
}
Object ob = instantiate(factoryName);
if (ob == null) { // could warn, if we had logging system (j.u.l?)
return null;
}
return ((Deserializers) ob).findBeanDeserializer(type, config, beanDesc);
}
/*
/**********************************************************
/* Internal helper methods
/**********************************************************
*/
private Object instantiate(String className)
{
try {
return Class.forName(className).newInstance();
} catch (LinkageError e) { }
// too many different kinds to enumerate here:
catch (Exception e) { }
return null;
}
/**
* Since 2.7 we only need to check for class extension, as all implemented
* types are classes
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>, not interfaces. This has performance implications for
* some cases, as we do not need to go over interfaces implemented, just
* superclasses
*
* @since 2.7
*/
private boolean hasSuperClassStartingWith(Class<?> rawType, String prefix)
{
for (Class<?> supertype = rawType.getSuperclass(); supertype != null; supertype = supertype.getSuperclass()) {
if (supertype == Object.class) {
return false;
}
if (supertype.getName().startsWith(prefix)) {
return true;
}
}
return false;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> problem; default behavior is to construct and
* throw a {@link JsonMappingException}, but in future may collect more than one
* and only throw after certain number, or at the end of serialization.
*
* @since 2.8
*/
public void reportMappingProblem(Throwable t, String message, Object... args) throws JsonMappingException {
throw mappingException(t, message, args);
}
/**
* Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific Java type, unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/
public <T> T reportBadTypeDefinition(BeanDescription bean,
String message, Object... args) throws JsonMappingException {
if (args != null && args.length > 0) {
message = String.format(message, args);
}
String beanDesc = (bean == null) ? "N/A" : _desc(bean.getType().getGenericSignature());
throw mappingException("Invalid type definition for type %s: %s",
beanDesc, message);
}
/**
* Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific property (of a type), unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/
public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop,
String message, Object... args) throws JsonMappingException {
if (args != null && args.length > 0) {
message = String.format(message, args);
}
String propName = (prop == null) ? "N/A" : _quotedString(prop.getName());
String beanDesc = (bean == null) ? "N/A" : _desc(bean.getType().getGenericSignature());
throw mappingException("Invalid definition for property %s (of type %s): %s",
propName, beanDesc, message);
}
/**
* @since 2.8
*/
public JsonGenerator getGenerator() {
return null;
}
/*
/********************************************************
/* Helper methods
/********************************************************
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> */
protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws IOException
{
// One special case: allow primitive/wrapper type coercion
if (rootType.isPrimitive()) {
Class<?> wrapperType = ClassUtil.wrapperType(rootType.getRawClass());
// If it's just difference between wrapper, primitive, let it slide
if (wrapperType.isAssignableFrom(value.getClass())) {
return;
}
}
reportMappingProblem("Incompatible types: declared root type (%s) vs %s",
rootType, value.getClass().getName());
}
/**
* Method that will try to find a serializer, either from cache
* or by constructing one; but will not return an "unknown" serializer
* if this can not be done but rather returns null.
*
* @return Serializer if one can be found, null if not.
*/
protected JsonSerializer<Object> _findExplicitUntypedSerializer(Class<?> runtimeType)
throws JsonMappingException
{
// Fast lookup from local lookup thingy works?
JsonSerializer<Object> ser = _knownSerializers.untypedValueSerializer(runtimeType);
if (ser == null) {
// If not, maybe shared map already has it?
ser = _serializerCache.untypedValueSerializer(runtimeType);
if (ser == null) {
ser = _createAndCacheUntypedSerializer(runtimeType);
}
}
/* 18-Sep-2014, tatu: This is unfortunate patch over related change
* that pushes creation of "unknown type" serializer deeper down
* in BeanSerializerFactory; as a result, we need to "undo" creation
* here.
*/
if (isUnknownTypeSerializer(ser)) {
return null;
}
return ser;
}
/*
/**********************************************************
/* Low-level methods for actually constructing and initializing
/* serializers
/**********************************************************
*/
/**
* Method that will try to construct a value serializer; and if
* one is successfully created, cache it for reuse.
*/
protected JsonSerializer<Object> _createAndCacheUntypedSerializer(Class<?> rawType)
throws JsonMappingException
{
JavaType fullType = _config.constructType(rawType);
JsonSerializer<Object> ser;
try {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> _superInterfaces, _elementType, null, null, _asStatic);
}
@Override
public JavaType withContentType(JavaType contentType) {
if (_elementType == contentType) {
return this;
}
return new CollectionType(_class, _bindings, _superClass, _superInterfaces,
contentType, _valueHandler, _typeHandler, _asStatic);
}
@Override
public CollectionType withTypeHandler(Object h) {
return new CollectionType(_class, _bindings,
_superClass, _superInterfaces, _elementType, _valueHandler, h, _asStatic);
}
@Override
public CollectionType withContentTypeHandler(Object h)
{
return new CollectionType(_class, _bindings,
_superClass, _superInterfaces, _elementType.withTypeHandler(h),
_valueHandler, _typeHandler, _asStatic);
}
@Override
public CollectionType withValueHandler(Object h) {
return new CollectionType(_class, _bindings,
_superClass, _superInterfaces, _elementType, h, _typeHandler, _asStatic);
}
@Override
public CollectionType withContentValueHandler(Object h) {
return new CollectionType(_class, _bindings,
_superClass, _superInterfaces, _elementType.withValueHandler(h),
_valueHandler, _typeHandler, _asStatic);
}
@Override
public CollectionType withStaticTyping() {
if (_asStatic) {
return this;
}
return new CollectionType(_class, _bindings,
_superClass, _superInterfaces, _elementType.withStaticTyping(),
_valueHandler, _typeHandler, true);
}
@Override
public JavaType refine(Class<?> rawType, TypeBindings bindings,
JavaType superClass, JavaType[] superInterfaces) {
return new CollectionType(rawType, bindings,
superClass, superInterfaces, _elementType,
_valueHandler, _typeHandler, _asStatic);
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override
public String toString()
{
return "[collection type; class "+_class.getName()+", contains "+_elementType+"]";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> || ignorable.length == 0) ?
null : ArrayBuilders.arrayToSet(ignorable);
}
public void setIgnorableProperties(Set<String> ignorable) {
_ignorableProperties = (ignorable == null || ignorable.size() == 0) ?
null : ignorable;
}
/*
/**********************************************************
/* Validation, post-processing (ResolvableDeserializer)
/**********************************************************
*/
@Override
public void resolve(DeserializationContext ctxt) throws JsonMappingException
{
// May need to resolve types for delegate- and/or property-based creators:
if (_valueInstantiator != null) {
if (_valueInstantiator.canCreateUsingDelegate()) {
JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid delegate-creator definition for "+_mapType
+": value instantiator ("+_valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'");
}
/* Theoretically should be able to get CreatorProperty for delegate
* parameter to pass; but things get tricky because DelegateCreator
* may contain injectable values. So, for now, let's pass nothing.
*/
_delegateDeserializer = findDeserializer(ctxt, delegateType, null);
} else if (_valueInstantiator.canCreateUsingArrayDelegate()) {
JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid delegate-creator definition for "+_mapType
+": value instantiator ("+_valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingDelegate()', but null for 'getArrayDelegateType()'");
}
_delegateDeserializer = findDeserializer(ctxt, delegateType, null);
}
}
if (_valueInstantiator.canCreateFromObjectWith()) {
SettableBeanProperty[] creatorProps = _valueInstantiator.getFromObjectArguments(ctxt.getConfig());
_propertyBasedCreator = PropertyBasedCreator.construct(ctxt, _valueInstantiator, creatorProps);
}
_standardStringKey = _isStdKeyDeser(_mapType, _keyDeserializer);
}
/**
* Method called to
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.*;
import com.fasterxml.jackson.databind.JavaType;
/**
* Placeholder used by virtual properties as placeholder for
* underlying {@link AnnotatedMember}.
*
* @since 2.5
*/
public class VirtualAnnotatedMember extends AnnotatedMember
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected final Class<?> _declaringClass;
/**
* @since 2.8 with this signature; had <code>_rawType</code> earlier
*/
protected final JavaType _type;
protected final String _name;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
public VirtualAnnotatedMember(TypeResolutionContext typeContext, Class<?> declaringClass,
String name, JavaType type)
{
super(typeContext, /* AnnotationMap*/ null);
_declaringClass = declaringClass;
_type = type;
_name = name;
}
/**
* @deprecated Since 2.8
*/
@Deprecated
public VirtualAnnotatedMember(TypeResolutionContext typeContext, Class<?> declaringClass,
String name, Class<?> rawType) {
this(typeContext, declaringClass, name, typeContext.resolveType(rawType));
}
@Override
public Annotated withAnnotations(AnnotationMap fallback) {
return this;
}
/*
/**********************************************************
/* Annotated impl
/**********************************************************
*/
@Override
public Field getAnnotated() { return null; }
@Override
public int getModifiers() { return 0; }
@Override
public String getName() { return _name; }
@Override
public Class<?> getRawType() {
return _type.getRawClass();
}
@Override
public JavaType getType() {
return _type;
}
/*
/**********************************************************
/* AnnotatedMember impl
/**********************************************************
*/
@Override
public Class<?> getDeclaringClass() { return _declaringClass; }
@Override
public Member getMember() { return null; }
@Override
public void setValue(Object pojo, Object value) throws IllegalArgumentException {
throw new IllegalArgumentException("Can not set virtual property '"+_name+"'");
}
@Override
public Object getValue(Object
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> pojo) throws IllegalArgumentException {
throw new IllegalArgumentException("Can not get virtual property '"+_name+"'");
}
/*
/**********************************************************
/* Extended API, generic
/**********************************************************
*/
public String getFullName() {
return getDeclaringClass().getName() + "#" + getName();
}
public int getAnnotationCount() { return 0; }
@Override
public int hashCode() {
return _name.hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
VirtualAnnotatedMember other = (VirtualAnnotatedMember) o;
return (other._declaringClass == _declaringClass)
&& other._name.equals(_name);
}
@Override
public String toString() {
return "[field "+getFullName()+"]";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.type;
import java.io.IOException;
import java.util.*;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
public abstract class TypeBase
extends JavaType
implements JsonSerializable
{
private static final long serialVersionUID = 1;
private final static TypeBindings NO_BINDINGS = TypeBindings.emptyBindings();
private final static JavaType[] NO_TYPES = new JavaType[0];
protected final JavaType _superClass;
protected final JavaType[] _superInterfaces;
/**
* Bindings in effect for this type instance; possibly empty.
* Needed when resolving types declared in members of this type
* (if any).
*
* @since 2.7
*/
protected final TypeBindings _bindings;
/**
* Lazily initialized external representation of the type
*/
volatile transient String _canonicalName;
/**
* Main constructor to use by extending classes.
*/
protected TypeBase(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts,
int hash,
Object valueHandler, Object typeHandler, boolean asStatic)
{
super(raw, hash, valueHandler, typeHandler, asStatic);
_bindings = (bindings == null) ? NO_BINDINGS : bindings;
_superClass = superClass;
_superInterfaces = superInts;
}
/**
* Copy-constructor used when refining/upgrading type instances.
*
* @since 2.7
*/
protected TypeBase(TypeBase base) {
super(base);
_superClass = base._superClass;
_superInterfaces = base._superInterfaces;
_bindings = base._bindings;
}
@Override
public String toCanonical()
{
String str = _canonicalName;
if (str == null) {
str = buildCanonicalName();
}
return str;
}
protected String buildCanonicalName() {
return _class.getName();
}
@Override
public abstract StringBuilder getGenericSignature(StringBuilder sb);
@Override
public abstract StringBuilder getErasedSignature(StringBuilder sb);
@Override
public
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>SuffixForScalar(this, gen);
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider provider)
throws IOException, JsonProcessingException
{
gen.writeString(toCanonical());
}
/*
/**********************************************************
/* Methods for sub-classes to use
/**********************************************************
*/
/**
* @param trailingSemicolon Whether to add trailing semicolon for non-primitive
* (reference) types or not
*/
protected static StringBuilder _classSignature(Class<?> cls, StringBuilder sb,
boolean trailingSemicolon)
{
if (cls.isPrimitive()) {
if (cls == Boolean.TYPE) {
sb.append('Z');
} else if (cls == Byte.TYPE) {
sb.append('B');
}
else if (cls == Short.TYPE) {
sb.append('S');
}
else if (cls == Character.TYPE) {
sb.append('C');
}
else if (cls == Integer.TYPE) {
sb.append('I');
}
else if (cls == Long.TYPE) {
sb.append('J');
}
else if (cls == Float.TYPE) {
sb.append('F');
}
else if (cls == Double.TYPE) {
sb.append('D');
}
else if (cls == Void.TYPE) {
sb.append('V');
} else {
throw new IllegalStateException("Unrecognized primitive type: "+cls.getName());
}
} else {
sb.append('L');
String name = cls.getName();
for (int i = 0, len = name.length(); i < len; ++i) {
char c = name.charAt(i);
if (c == '.') c = '/';
sb.append(c);
}
if (trailingSemicolon) {
sb.append(';');
}
}
return sb;
}
/**
* Internal helper method used to figure out nominal super-class for
* deprecated factory methods / constructors, where we are not given
* properly resolved supertype hierarchy.
* Will basically give `JavaType` for `java.lang.Object` for classes
* other than `java.lafgn.Object`; null for others.
*
* @since 2.7
*/
protected static
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)",
value.getClass().getName());
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
/*
/**********************************************************
/* BeanProperty impl
/**********************************************************
*/
@Override
public <A extends Annotation> A getAnnotation(Class<A> acls) {
return _annotated.getAnnotation(acls);
}
@Override public AnnotatedMember getMember() { return _annotated; }
/*
/**********************************************************
/* Overridden methods
/**********************************************************
*/
@Override
public final void deserializeAndSet(JsonParser p, DeserializationContext ctxt,
Object instance) throws IOException
{
JsonToken t = p.getCurrentToken();
if (t == JsonToken.VALUE_NULL) {
/* Hmmh. Is this a problem? We won't be setting anything, so it's
* equivalent of empty Collection/Map in this case
*/
return;
}
// For [#501] fix we need to implement this but:
if (_valueTypeDeserializer != null) {
ctxt.reportMappingException(
"Problem deserializing 'setterless' property (\"%s\"): no way to handle typed deser with setterless yet",
getName());
// return _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer);
}
// Ok: then, need to fetch Collection/Map to modify:
Object toModify;
try {
toModify = _getter.invoke(instance);
} catch (Exception e) {
_throwAsIOE(p, e);
return; // never gets here
}
/* Note: null won't work, since we can't then inject anything
* in. At least that's not good in common case. However,
* theoretically the case where we get JSON null might
* be compatible. If so, implementation could be changed.
*/
if (toModify == null) {
throw JsonMappingException.from(p,
"Problem deserializing 'setterless' property '"+getName()+"': get method returned null");
}
_valueDeserializer.deserialize(p, ctxt, toModify);
}
@Override
public Object deserializeSetAndReturn(JsonParser p,
DeserializationContext ctxt, Object instance) throws IOException
{
deserializeAndSet(p, ctxt, instance);
return instance;
}
@Override
public final void set(Object instance,
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> Jackson classes: NOT to be used by application code:
* it does NOT properly handle inspection of super-types, so neither parent
* Classes nor implemented Interfaces are accessible with resulting type
* instance.
*<p>
* NOTE: public only because it is called by <code>ObjectMapper</code> which is
* not in same package
*/
public static SimpleType constructUnsafe(Class<?> raw) {
return new SimpleType(raw, null,
// 18-Oct-2015, tatu: Should be ok to omit possible super-types, right?
null, null, null, null, false);
}
/**
* Method that should NOT to be used by application code:
* it does NOT properly handle inspection of super-types, so neither parent
* Classes nor implemented Interfaces are accessible with resulting type
* instance. Instead, please use {@link TypeFactory}'s <code>constructType</code>
* methods which handle introspection appropriately.
*<p>
* Note that prior to 2.7, method usage was not limited and would typically
* have worked acceptably: the problem comes from inability to resolve super-type
* information, for which {@link TypeFactory} is needed.
*
* @deprecated Since 2.7
*/
@Deprecated
public static SimpleType construct(Class<?> cls)
{
/* Let's add sanity checks, just to ensure no
* Map/Collection entries are constructed
*/
if (Map.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Can not construct SimpleType for a Map (class: "+cls.getName()+")");
}
if (Collection.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Can not construct SimpleType for a Collection (class: "+cls.getName()+")");
}
// ... and while we are at it, not array types either
if (cls.isArray()) {
throw new IllegalArgumentException("Can not construct SimpleType for an array (class: "+cls.getName()+")");
}
TypeBindings b = TypeBindings.emptyBindings();
return new SimpleType(cls, b,
_buildSuperClass(cls.getSuperclass(), b), null, null, null, false);
}
@Override
@Deprecated
protected JavaType _narrow(Class<?> subclass)
{
if (_class
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> == subclass) {
return this;
}
// Should we check that there is a sub-class relationship?
// 15-Jan-2016, tatu: Almost yes, but there are some complications with
// placeholder values (`Void`, `NoClass`), so can not quite do yet.
// TODO: fix in 2.9
if (!_class.isAssignableFrom(subclass)) {
/*
throw new IllegalArgumentException("Class "+subclass.getName()+" not sub-type of "
+_class.getName());
*/
return new SimpleType(subclass, _bindings, this, _superInterfaces,
_valueHandler, _typeHandler, _asStatic);
}
// Otherwise, stitch together the hierarchy. First, super-class
Class<?> next = subclass.getSuperclass();
if (next == _class) { // straight up parent class? Great.
return new SimpleType(subclass, _bindings, this,
_superInterfaces, _valueHandler, _typeHandler, _asStatic);
}
if ((next != null) && _class.isAssignableFrom(next)) {
JavaType superb = _narrow(next);
return new SimpleType(subclass, _bindings, superb,
null, _valueHandler, _typeHandler, _asStatic);
}
// if not found, try a super-interface
Class<?>[] nextI = subclass.getInterfaces();
for (Class<?> iface : nextI) {
if (iface == _class) { // directly implemented
return new SimpleType(subclass, _bindings, null,
new JavaType[] { this }, _valueHandler, _typeHandler, _asStatic);
}
if (_class.isAssignableFrom(iface)) { // indirect, so recurse
JavaType superb = _narrow(iface);
return new SimpleType(subclass, _bindings, null,
new JavaType[] { superb }, _valueHandler, _typeHandler, _asStatic);
}
}
// should not get here but...
throw new IllegalArgumentException("Internal error: Can not resolve sub-type for Class "+subclass.getName()+" to "
+_class.getName());
}
@Override
public JavaType withContentType(JavaType contentType) {
throw new IllegalArgumentException("Simple types have no content types; can not call withContentType()");
}
@Override
public Simple
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Type withTypeHandler(Object h) {
if (_typeHandler == h) {
return this;
}
return new SimpleType(_class, _bindings, _superClass, _superInterfaces, _valueHandler, h, _asStatic);
}
@Override
public JavaType withContentTypeHandler(Object h) {
// no content type, so:
throw new IllegalArgumentException("Simple types have no content types; can not call withContenTypeHandler()");
}
@Override
public SimpleType withValueHandler(Object h) {
if (h == _valueHandler) {
return this;
}
return new SimpleType(_class, _bindings, _superClass, _superInterfaces, h, _typeHandler, _asStatic);
}
@Override
public SimpleType withContentValueHandler(Object h) {
// no content type, so:
throw new IllegalArgumentException("Simple types have no content types; can not call withContenValueHandler()");
}
@Override
public SimpleType withStaticTyping() {
return _asStatic ? this : new SimpleType(_class, _bindings,
_superClass, _superInterfaces, _valueHandler, _typeHandler, true);
}
@Override
public JavaType refine(Class<?> rawType, TypeBindings bindings,
JavaType superClass, JavaType[] superInterfaces) {
// SimpleType means something not-specialized, so:
return null;
}
@Override
protected String buildCanonicalName()
{
StringBuilder sb = new StringBuilder();
sb.append(_class.getName());
final int count = _bindings.size();
if (count > 0) {
sb.append('<');
for (int i = 0; i < count; ++i) {
JavaType t = containedType(i);
if (i > 0) {
sb.append(',');
}
sb.append(t.toCanonical());
}
sb.append('>');
}
return sb.toString();
}
/*
/**********************************************************
/* Public API
/**********************************************************
*/
@Override
public boolean isContainerType() { return false; }
@Override
public boolean hasContentType() { return false; }
@Override
public StringBuilder getErasedSignature(StringBuilder sb) {
return _classSignature(_class, sb, true);
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.util;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
/**
* Helper class that contains functionality needed by both serialization
* and deserialization side.
*/
public class BeanUtil
{
/*
/**********************************************************
/* Handling property names
/**********************************************************
*/
/**
* @since 2.5
*/
public static String okNameForGetter(AnnotatedMethod am, boolean stdNaming) {
String name = am.getName();
String str = okNameForIsGetter(am, name, stdNaming);
if (str == null) {
str = okNameForRegularGetter(am, name, stdNaming);
}
return str;
}
/**
* @since 2.5
*/
public static String okNameForRegularGetter(AnnotatedMethod am, String name,
boolean stdNaming)
{
if (name.startsWith("get")) {
/* 16-Feb-2009, tatu: To handle [JACKSON-53], need to block
* CGLib-provided method "getCallbacks". Not sure of exact
* safe criteria to get decent coverage without false matches;
* but for now let's assume there's no reason to use any
* such getter from CGLib.
* But let's try this approach...
*/
if ("getCallbacks".equals(name)) {
if (isCglibGetCallbacks(am)) {
return null;
}
} else if ("getMetaClass".equals(name)) {
// 30-Apr-2009, tatu: Need to suppress serialization of a cyclic reference
if (isGroovyMetaClassGetter(am)) {
return null;
}
}
return stdNaming
? stdManglePropertyName(name, 3)
: legacyManglePropertyName(name, 3);
}
return null;
}
/**
* @since 2.5
*/
public static String okNameForIsGetter(AnnotatedMethod am, String name,
boolean stdNaming)
{
if (name.startsWith("is")) { // plus, must return a boolean
Class<?> rt = am.getRawType();
if (rt == Boolean.class || rt == Boolean.TYPE) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> return stdNaming
? stdManglePropertyName(name, 2)
: legacyManglePropertyName(name, 2);
}
}
return null;
}
/**
* @since 2.5
*/
public static String okNameForSetter(AnnotatedMethod am, boolean stdNaming) {
String name = okNameForMutator(am, "set", stdNaming);
if ((name != null)
// 26-Nov-2009, tatu: need to suppress this internal groovy method
&& (!"metaClass".equals(name) || !isGroovyMetaClassSetter(am))) {
return name;
}
return null;
}
/**
* @since 2.5
*/
public static String okNameForMutator(AnnotatedMethod am, String prefix,
boolean stdNaming) {
String name = am.getName();
if (name.startsWith(prefix)) {
return stdNaming
? stdManglePropertyName(name, prefix.length())
: legacyManglePropertyName(name, prefix.length());
}
return null;
}
/*
/**********************************************************
/* Handling property names, deprecated methods
/**********************************************************
*/
@Deprecated // since 2.5
public static String okNameForGetter(AnnotatedMethod am) {
return okNameForGetter(am, false);
}
@Deprecated // since 2.5
public static String okNameForRegularGetter(AnnotatedMethod am, String name) {
return okNameForRegularGetter(am, name, false);
}
@Deprecated // since 2.5
public static String okNameForIsGetter(AnnotatedMethod am, String name) {
return okNameForIsGetter(am, name, false);
}
@Deprecated // since 2.5
public static String okNameForSetter(AnnotatedMethod am) {
return okNameForSetter(am, false);
}
@Deprecated // since 2.5
public static String okNameForMutator(AnnotatedMethod am, String prefix) {
return okNameForMutator(am, prefix, false);
}
/*
/**********************************************************
/* Special case handling
/**********************************************************
*/
/**
* This method was added to address [JACKSON-53]: need to weed out
* CGLib-
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.append("UNRESOLVED");
} else {
// [databind#1301]: Typically resolves to a loop so short-cut
// and only include type-erased class
sb.append(_referencedType.getRawClass().getName());
}
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null) return false;
// Do NOT ever match unresolved references
if (_referencedType == null) {
return false;
}
return (o.getClass() == getClass()
&& _referencedType.equals(((ResolvedRecursiveType) o).getSelfReferencedType()));
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> protected String buildCanonicalName() {
StringBuilder sb = new StringBuilder();
sb.append(_class.getName());
if (_elementType != null) {
sb.append('<');
sb.append(_elementType.toCanonical());
sb.append('>');
}
return sb.toString();
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Method that can be used for checking whether this type is a
* "real" Collection type; meaning whether it represents a parameterized
* subtype of {@link java.util.Collection} or just something that acts
* like one.
*/
public boolean isTrueCollectionType() {
return Collection.class.isAssignableFrom(_class);
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;
CollectionLikeType other = (CollectionLikeType) o;
return (_class == other._class) && _elementType.equals(other._elementType);
}
@Override
public String toString()
{
return "[collection-like type; class "+_class.getName()+", contains "+_elementType+"]";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> newName);
_delegate = src._delegate.withName(newName);
_creator = src._creator;
}
@Override
public InnerClassProperty withName(PropertyName newName) {
return new InnerClassProperty(this, newName);
}
@Override
public InnerClassProperty withValueDeserializer(JsonDeserializer<?> deser) {
return new InnerClassProperty(this, deser);
}
@Override
public void assignIndex(int index) { _delegate.assignIndex(index); }
@Override
public int getPropertyIndex() { return _delegate.getPropertyIndex(); }
@Override
public int getCreatorIndex() { return _delegate.getCreatorIndex(); }
@Override
public void fixAccess(DeserializationConfig config) {
_delegate.fixAccess(config);
}
// // // BeanProperty impl
@Override
public <A extends Annotation> A getAnnotation(Class<A> acls) {
return _delegate.getAnnotation(acls);
}
@Override public AnnotatedMember getMember() { return _delegate.getMember(); }
/*
/**********************************************************
/* Deserialization methods
/**********************************************************
*/
@Override
public void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object bean)
throws IOException
{
JsonToken t = jp.getCurrentToken();
Object value;
if (t == JsonToken.VALUE_NULL) {
value = _valueDeserializer.getNullValue(ctxt);
} else if (_valueTypeDeserializer != null) {
value = _valueDeserializer.deserializeWithType(jp, ctxt, _valueTypeDeserializer);
} else { // the usual case
try {
value = _creator.newInstance(bean);
} catch (Exception e) {
ClassUtil.unwrapAndThrowAsIAE(e, "Failed to instantiate class "+_creator.getDeclaringClass().getName()+", problem: "+e.getMessage());
value = null;
}
_valueDeserializer.deserialize(jp, ctxt, value);
}
set(bean, value);
}
@Override
public Object deserializeSetAndReturn(JsonParser jp,
DeserializationContext ctxt, Object instance)
throws IOException
{
return setAndReturn(instance, deserialize(jp, ctxt));
}
@Override
public final void set(Object instance, Object value) throws IOException {
_delegate.set(
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> Class#getName}).
*
* @since 2.5
*/
public Object getTypeId() {
return getClass().getName();
}
/*
/**********************************************************
/* Life-cycle: registration
/**********************************************************
*/
/**
* Method called by {@link ObjectMapper} when module is registered.
* It is called to let module register functionality it provides,
* using callback methods passed-in context object exposes.
*/
public abstract void setupModule(SetupContext context);
/*
/**********************************************************
/* Helper types
/**********************************************************
*/
/**
* Interface Jackson exposes to modules for purpose of registering
* extended functionality.
* Usually implemented by {@link ObjectMapper}, but modules should
* NOT rely on this -- if they do require access to mapper instance,
* they need to call {@link SetupContext#getOwner} method.
*/
public static interface SetupContext
{
/*
/**********************************************************
/* Simple accessors
/**********************************************************
*/
/**
* Method that returns version information about {@link ObjectMapper}
* that implements this context. Modules can use this to choose
* different settings or initialization order; or even decide to fail
* set up completely if version is compatible with module.
*/
public Version getMapperVersion();
/**
* Fallback access method that allows modules to refer to the
* {@link ObjectMapper} that provided this context.
* It should NOT be needed by most modules; and ideally should
* not be used -- however, there may be cases where this may
* be necessary due to various design constraints.
*<p>
* NOTE: use of this method is discouraged, as it allows access to
* things Modules typically should not modify. It is included, however,
* to allow access to new features in cases where Module API
* has not yet been extended, or there are oversights.
*<p>
* Return value is chosen to not leak dependency to {@link ObjectMapper};
* however, instance will always be of that type.
* This is why return value is declared generic, to allow caller to
* specify context to often avoid casting.
*
* @since 2.0
*/
public <C extends ObjectCodec> C getOwner();
/**
* Accessor for finding {@link TypeFactory} that is currently configured
* by the context.
*<p>
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> ("void".equals(className)) return Void.TYPE;
return null;
}
/*
/**********************************************************
/* Type conversion, parameterization resolution methods
/**********************************************************
*/
/**
* Factory method for creating a subtype of given base type, as defined
* by specified subclass; but retaining generic type information if any.
* Can be used, for example, to get equivalent of "HashMap<String,Integer>"
* from "Map<String,Integer>" by giving <code>HashMap.class</code>
* as subclass.
*/
public JavaType constructSpecializedType(JavaType baseType, Class<?> subclass)
{
// simple optimization to avoid costly introspection if type-erased type does NOT differ
final Class<?> rawBase = baseType.getRawClass();
if (rawBase == subclass) {
return baseType;
}
JavaType newType;
// also: if we start from untyped, not much to save
do { // bogus loop to be able to break
if (rawBase == Object.class) {
newType = _fromClass(null, subclass, TypeBindings.emptyBindings());
break;
}
if (!rawBase.isAssignableFrom(subclass)) {
throw new IllegalArgumentException(String.format(
"Class %s not subtype of %s", subclass.getName(), baseType));
}
// A few special cases where we can simplify handling:
// (1) Original target type has no generics -- just resolve subtype
if (baseType.getBindings().isEmpty()) {
newType = _fromClass(null, subclass, TypeBindings.emptyBindings());
break;
}
// (2) A small set of "well-known" List/Map subtypes where can take a short-cut
if (baseType.isContainerType()) {
if (baseType.isMapLikeType()) {
if ((subclass == HashMap.class)
|| (subclass == LinkedHashMap.class)
|| (subclass == EnumMap.class)
|| (subclass == TreeMap.class)) {
newType = _fromClass(null, subclass,
TypeBindings.create(subclass, baseType.getKeyType(), baseType.getContentType()));
break;
}
} else if (baseType.isCollectionLikeType()) {
if ((subclass
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> to partially resolve the type hierarchy
// (hopefully passing null Class for root is ok)
int baseCount = baseType.containedTypeCount();
if (baseCount == typeParamCount) {
if (typeParamCount == 1) {
return TypeBindings.create(subclass, baseType.containedType(0));
}
if (typeParamCount == 2) {
return TypeBindings.create(subclass, baseType.containedType(0),
baseType.containedType(1));
}
List<JavaType> types = new ArrayList<JavaType>(baseCount);
for (int i = 0; i < baseCount; ++i) {
types.add(baseType.containedType(i));
}
return TypeBindings.create(subclass, types);
}
// Otherwise, two choices: match N first, or empty. Do latter, for now
return TypeBindings.emptyBindings();
}
/**
* Method similar to {@link #constructSpecializedType}, but that creates a
* less-specific type of given type. Usually this is as simple as simply
* finding super-type with type erasure of <code>superClass</code>, but
* there may be need for some additional work-arounds.
*
* @param superClass
*
* @since 2.7
*/
public JavaType constructGeneralizedType(JavaType baseType, Class<?> superClass)
{
// simple optimization to avoid costly introspection if type-erased type does NOT differ
final Class<?> rawBase = baseType.getRawClass();
if (rawBase == superClass) {
return baseType;
}
JavaType superType = baseType.findSuperType(superClass);
if (superType == null) {
// Most likely, caller did not verify sub/super-type relationship
if (!superClass.isAssignableFrom(rawBase)) {
throw new IllegalArgumentException(String.format(
"Class %s not a super-type of %s", superClass.getName(), baseType));
}
// 01-Nov-2015, tatu: Should never happen, but ch
throw new IllegalArgumentException(String.format(
"Internal error: class %s not included as super-type for %s",
superClass.getName(), baseType));
}
return superType;
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>> typeParams = bindings.getTypeParameters();
// ok to have no types ("raw")
switch (typeParams.size()) {
case 0: // acceptable?
kt = vt = _unknownType();
break;
case 2:
kt = typeParams.get(0);
vt = typeParams.get(1);
break;
default:
throw new IllegalArgumentException("Strange Map type "+rawClass.getName()+": can not determine type parameters");
}
}
return MapType.construct(rawClass, bindings, superClass, superInterfaces, kt, vt);
}
private JavaType _collectionType(Class<?> rawClass, TypeBindings bindings,
JavaType superClass, JavaType[] superInterfaces)
{
List<JavaType> typeParams = bindings.getTypeParameters();
// ok to have no types ("raw")
JavaType ct;
if (typeParams.isEmpty()) {
ct = _unknownType();
} else if (typeParams.size() == 1) {
ct = typeParams.get(0);
} else {
throw new IllegalArgumentException("Strange Collection type "+rawClass.getName()+": can not determine type parameters");
}
return CollectionType.construct(rawClass, bindings, superClass, superInterfaces, ct);
}
private JavaType _referenceType(Class<?> rawClass, TypeBindings bindings,
JavaType superClass, JavaType[] superInterfaces)
{
List<JavaType> typeParams = bindings.getTypeParameters();
// ok to have no types ("raw")
JavaType ct;
if (typeParams.isEmpty()) {
ct = _unknownType();
} else if (typeParams.size() == 1) {
ct = typeParams.get(0);
} else {
throw new IllegalArgumentException("Strange Reference type "+rawClass.getName()+": can not determine type parameters");
}
return ReferenceType.construct(rawClass, bindings, superClass, superInterfaces, ct);
}
/**
* Factory method to call when no special {@link JavaType} is needed,
* no generic parameters are passed. Default implementation may check
* pre-constructed values for "well-known" types, but if none found
* will simply call {@link #_newSimpleType}
*
* @since 2.7
*/
protected JavaType _constructSimple(
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> passed
* as Java typing returned from <code>getGenericXxx</code> methods
* (usually for a return or argument type).
*/
protected JavaType _fromAny(ClassStack context, Type type, TypeBindings bindings)
{
JavaType resultType;
// simple class?
if (type instanceof Class<?>) {
// Important: remove possible bindings since this is type-erased thingy
resultType = _fromClass(context, (Class<?>) type, EMPTY_BINDINGS);
}
// But if not, need to start resolving.
else if (type instanceof ParameterizedType) {
resultType = _fromParamType(context, (ParameterizedType) type, bindings);
}
else if (type instanceof JavaType) { // [databind#116]
// no need to modify further if we already had JavaType
return (JavaType) type;
}
else if (type instanceof GenericArrayType) {
resultType = _fromArrayType(context, (GenericArrayType) type, bindings);
}
else if (type instanceof TypeVariable<?>) {
resultType = _fromVariable(context, (TypeVariable<?>) type, bindings);
}
else if (type instanceof WildcardType) {
resultType = _fromWildcard(context, (WildcardType) type, bindings);
} else {
// sanity check
throw new IllegalArgumentException("Unrecognized Type: "+((type == null) ? "[null]" : type.toString()));
}
/* 21-Feb-2016, nateB/tatu: as per [databind#1129] (applied for 2.7.2),
* we do need to let all kinds of types to be refined, esp. for Scala module.
*/
if (_modifiers != null) {
TypeBindings b = resultType.getBindings();
if (b == null) {
b = EMPTY_BINDINGS;
}
for (TypeModifier mod : _modifiers) {
JavaType t = mod.modifyType(resultType, type, b, this);
if (t == null) {
throw new IllegalStateException(String.format(
"TypeModifier %s (of type %s) return null for type %s",
mod, mod.getClass().getName(), resultType));
}
resultType = t;
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>ParamType(ClassStack context, ParameterizedType ptype,
TypeBindings parentBindings)
{
// Assumption here is we'll always get Class, not one of other Types
Class<?> rawType = (Class<?>) ptype.getRawType();
// 29-Oct-2015, tatu: For performance reasons, let's streamline handling of
// couple of not-so-useful parametric types
if (rawType == CLS_ENUM) {
return CORE_TYPE_ENUM;
}
if (rawType == CLS_COMPARABLE) {
return CORE_TYPE_COMPARABLE;
}
if (rawType == CLS_CLASS) {
return CORE_TYPE_CLASS;
}
// First: what is the actual base type? One odd thing is that 'getRawType'
// returns Type, not Class<?> as one might expect. But let's assume it is
// always of type Class: if not, need to add more code to resolve it to Class.
Type[] args = ptype.getActualTypeArguments();
int paramCount = (args == null) ? 0 : args.length;
JavaType[] pt;
TypeBindings newBindings;
if (paramCount == 0) {
newBindings = EMPTY_BINDINGS;
} else {
pt = new JavaType[paramCount];
for (int i = 0; i < paramCount; ++i) {
pt[i] = _fromAny(context, args[i], parentBindings);
}
newBindings = TypeBindings.create(rawType, pt);
}
return _fromClass(context, rawType, newBindings);
}
protected JavaType _fromArrayType(ClassStack context, GenericArrayType type, TypeBindings bindings)
{
JavaType elementType = _fromAny(context, type.getGenericComponentType(), bindings);
return ArrayType.construct(elementType, bindings);
}
protected JavaType _fromVariable(ClassStack context, TypeVariable<?> var, TypeBindings bindings)
{
// ideally should find it via bindings:
final String name = var.getName();
JavaType type = bindings.findBoundType(name);
if (type != null) {
return type;
}
// but if not, use bounds... note that approach here is simp
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> config)
{
if (_factoryConfig == config) {
return this;
}
/* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor;
* and we pretty much have to here either choose between losing subtype instance
* when registering additional deserializers, or losing deserializers.
* Instead, let's actually just throw an error if this method is called when subtype
* has not properly overridden this method; this to indicate problem as soon as possible.
*/
if (getClass() != BeanDeserializerFactory.class) {
throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName()
+") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with "
+"additional deserializer definitions");
}
return new BeanDeserializerFactory(config);
}
/*
/**********************************************************
/* DeserializerFactory API implementation
/**********************************************************
*/
/**
* Method that {@link DeserializerCache}s call to create a new
* deserializer for types other than Collections, Maps, arrays and
* enums.
*/
@Override
public JsonDeserializer<Object> createBeanDeserializer(DeserializationContext ctxt,
JavaType type, BeanDescription beanDesc)
throws JsonMappingException
{
final DeserializationConfig config = ctxt.getConfig();
// We may also have custom overrides:
JsonDeserializer<Object> custom = _findCustomBeanDeserializer(type, config, beanDesc);
if (custom != null) {
return custom;
}
/* One more thing to check: do we have an exception type
* (Throwable or its sub-classes)? If so, need slightly
* different handling.
*/
if (type.isThrowable()) {
return buildThrowableDeserializer(ctxt, type, beanDesc);
}
/* Or, for abstract types, may have alternate means for resolution
* (defaulting, materialization)
*/
// 29-Nov-2015, tatu: Also, filter out calls to primitive types, they are
// not something we could materialize anything for
if (type.isAbstract() && !type.isPrimitive() && !type.isEnumType()) {
// Let's make it possible to materialize abstract types.
JavaType concreteType = materializeAbstract
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> (buildMethod != null) { // note: can't yet throw error; may be given build method
if (config.canOverrideAccessModifiers()) {
ClassUtil.checkAndFixAccess(buildMethod.getMember(), config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
}
builder.setPOJOBuilder(buildMethod, builderConfig);
// this may give us more information...
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
builder = mod.updateBuilder(config, builderDesc, builder);
}
}
JsonDeserializer<?> deserializer = builder.buildBuilderBased(
valueType, buildMethodName);
// [JACKSON-440]: may have modifier(s) that wants to modify or replace serializer we just built:
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
deserializer = mod.modifyDeserializer(config, builderDesc, deserializer);
}
}
return (JsonDeserializer<Object>) deserializer;
}
protected void addObjectIdReader(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder)
throws JsonMappingException
{
ObjectIdInfo objectIdInfo = beanDesc.getObjectIdInfo();
if (objectIdInfo == null) {
return;
}
Class<?> implClass = objectIdInfo.getGeneratorType();
JavaType idType;
SettableBeanProperty idProp;
ObjectIdGenerator<?> gen;
ObjectIdResolver resolver = ctxt.objectIdResolverInstance(beanDesc.getClassInfo(), objectIdInfo);
// Just one special case: Property-based generator is trickier
if (implClass == ObjectIdGenerators.PropertyGenerator.class) { // most special one, needs extra work
PropertyName propName = objectIdInfo.getPropertyName();
idProp = builder.findProperty(propName);
if (idProp == null) {
throw new IllegalArgumentException("Invalid Object Id definition for "
+beanDesc.getBeanClass().getName()+": can not find property with name '"+propName+"'");
}
idType = idProp.getType();
gen = new PropertyBasedObjectIdGenerator(objectIdInfo.getScope());
} else {
JavaType type = ctxt.constructType(implClass);
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
propDefs = mod.updateProperties(ctxt.getConfig(), beanDesc, propDefs);
}
}
// At which point we still have all kinds of properties; not all with mutators:
for (BeanPropertyDefinition propDef : propDefs) {
SettableBeanProperty prop = null;
/* 18-Oct-2013, tatu: Although constructor parameters have highest precedence,
* we need to do linkage (as per [databind#318]), and so need to start with
* other types, and only then create constructor parameter, if any.
*/
if (propDef.hasSetter()) {
JavaType propertyType = propDef.getSetter().getParameterType(0);
prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
} else if (propDef.hasField()) {
JavaType propertyType = propDef.getField().getType();
prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
} else if (useGettersAsSetters && propDef.hasGetter()) {
/* May also need to consider getters
* for Map/Collection properties; but with lowest precedence
*/
AnnotatedMethod getter = propDef.getGetter();
// should only consider Collections and Maps, for now?
Class<?> rawPropertyType = getter.getRawType();
if (Collection.class.isAssignableFrom(rawPropertyType)
|| Map.class.isAssignableFrom(rawPropertyType)) {
prop = constructSetterlessProperty(ctxt, beanDesc, propDef);
}
}
// 25-Sep-2014, tatu: No point in finding constructor parameters for abstract types
// (since they are never used anyway)
if (isConcrete && propDef.hasConstructorParameter()) {
/* If property is passed via constructor parameter, we must
* handle things in special way. Not sure what is the most optimal way...
* for now, let's just call a (new) method in builder, which does nothing.
*/
// but let's call a method just to allow custom builders to be aware...
final String name = propDef.getName();
CreatorProperty cprop = null;
if (
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>creatorProps != null) {
for (SettableBeanProperty cp : creatorProps) {
if (name.equals(cp.getName()) && (cp instanceof CreatorProperty)) {
cprop = (CreatorProperty) cp;
break;
}
}
}
if (cprop == null) {
ctxt.reportMappingException("Could not find creator property with name '%s' (in class %s)",
name, beanDesc.getBeanClass().getName());
continue;
}
if (prop != null) {
cprop.setFallbackSetter(prop);
}
prop = cprop;
builder.addCreatorProperty(cprop);
continue;
}
if (prop != null) {
Class<?>[] views = propDef.findViews();
if (views == null) {
// one more twist: if default inclusion disabled, need to force empty set of views
if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) {
views = NO_VIEWS;
}
}
// one more thing before adding to builder: copy any metadata
prop.setViews(views);
builder.addProperty(prop);
}
}
}
/**
* Helper method called to filter out explicit ignored properties,
* as well as properties that have "ignorable types".
* Note that this will not remove properties that have no
* setters.
*/
protected List<BeanPropertyDefinition> filterBeanProps(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder,
List<BeanPropertyDefinition> propDefsIn,
Set<String> ignored)
throws JsonMappingException
{
ArrayList<BeanPropertyDefinition> result = new ArrayList<BeanPropertyDefinition>(
Math.max(4, propDefsIn.size()));
HashMap<Class<?>,Boolean> ignoredTypes = new HashMap<Class<?>,Boolean>();
// These are all valid setters, but we do need to introspect bit more
for (BeanPropertyDefinition property : propDefsIn) {
String name = property.getName();
if (ignored.contains(name)) { // explicit ignoral using @JsonIgnoreProperties needs to block entries
continue;
}
if (!property.hasConstructorParameter()) { // never skip constructor params
Class<?> rawPropertyType = null;
if (property.hasSetter()) {
rawPropertyType = property.
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>getSetter().getRawParameterType(0);
} else if (property.hasField()) {
rawPropertyType = property.getField().getRawType();
}
// Some types are declared as ignorable as well
if ((rawPropertyType != null)
&& isIgnorableType(ctxt.getConfig(), beanDesc, rawPropertyType, ignoredTypes)) {
// important: make ignorable, to avoid errors if value is actually seen
builder.addIgnorable(name);
continue;
}
}
result.add(property);
}
return result;
}
/**
* Method that will find if bean has any managed- or back-reference properties,
* and if so add them to bean, to be linked during resolution phase.
*/
protected void addReferenceProperties(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder)
throws JsonMappingException
{
// and then back references, not necessarily found as regular properties
Map<String,AnnotatedMember> refs = beanDesc.findBackReferenceProperties();
if (refs != null) {
for (Map.Entry<String, AnnotatedMember> en : refs.entrySet()) {
String name = en.getKey();
AnnotatedMember m = en.getValue();
JavaType type;
if (m instanceof AnnotatedMethod) {
type = ((AnnotatedMethod) m).getParameterType(0);
} else {
type = m.getType();
}
SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct(
ctxt.getConfig(), m);
builder.addBackReferenceProperty(name, constructSettableProperty(ctxt,
beanDesc, propDef, type));
}
}
}
/**
* Method called locate all members used for value injection (if any),
* constructor {@link com.fasterxml.jackson.databind.deser.impl.ValueInjector} instances, and add them to builder.
*/
protected void addInjectables(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder)
throws JsonMappingException
{
Map<Object, AnnotatedMember> raw = beanDesc.findInjectables();
if (raw != null) {
for (Map.Entry<Object, AnnotatedMember> entry : raw.entrySet()) {
AnnotatedMember m = entry.getValue();
builder.addInjectable(PropertyName.construct(m.getName()),
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
m.getType(),
beanDesc.getClassAnnotations(), m, entry.getKey());
}
}
}
/**
* Method called to construct fallback {@link SettableAnyProperty}
* for handling unknown bean properties, given a method that
* has been designated as such setter.
*
* @param mutator Either 2-argument method (setter, with key and value), or Field
* that contains Map; either way accessor used for passing "any values"
*/
@SuppressWarnings("unchecked")
protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt,
BeanDescription beanDesc, AnnotatedMember mutator)
throws JsonMappingException
{
//find the java type based on the annotated setter method or setter field
JavaType type = null;
if (mutator instanceof AnnotatedMethod) {
// we know it's a 2-arg method, second arg is the value
type = ((AnnotatedMethod) mutator).getParameterType(1);
} else if (mutator instanceof AnnotatedField) {
// get the type from the content type of the map object
type = ((AnnotatedField) mutator).getType().getContentType();
}
// First: various annotations on type itself, as well as type-overrides
// on accessor need to be resolved
type = resolveMemberAndTypeAnnotations(ctxt, mutator, type);
BeanProperty.Std prop = new BeanProperty.Std(PropertyName.construct(mutator.getName()),
type, null, beanDesc.getClassAnnotations(), mutator,
PropertyMetadata.STD_OPTIONAL);
// and then possible direct deserializer override on accessor
JsonDeserializer<Object> deser = findDeserializerFromAnnotation(ctxt, mutator);
if (deser == null) {
deser = type.getValueHandler();
}
if (deser != null) {
// As per [databind#462] need to ensure we contextualize deserializer before passing it on
deser = (JsonDeserializer<Object>) ctxt.handlePrimaryContextualization(deser, prop, type);
}
TypeDeserializer typeDeser = type.getTypeHandler();
return new SettableAnyProperty(prop, mutator, type, deser, typeDeser);
}
/**
* Method that will construct a regular bean property setter using
* the given setter method.
*
* @return Property constructed,
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> if any; or null to indicate that
* there should be no property based on given definitions.
*/
protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt,
BeanDescription beanDesc, BeanPropertyDefinition propDef,
JavaType propType0)
throws JsonMappingException
{
// need to ensure method is callable (for non-public)
AnnotatedMember mutator = propDef.getNonConstructorMutator();
// 08-Sep-2016, tatu: issues like [databind#1342] suggest something fishy
// going on; add sanity checks to try to pin down actual problem...
// Possibly passing creator parameter?
if (mutator == null) {
ctxt.reportBadPropertyDefinition(beanDesc, propDef, "No non-constructor mutator available");
}
JavaType type = resolveMemberAndTypeAnnotations(ctxt, mutator, propType0);
// Does the Method specify the deserializer to use? If so, let's use it.
TypeDeserializer typeDeser = type.getTypeHandler();
SettableBeanProperty prop;
if (mutator instanceof AnnotatedMethod) {
prop = new MethodProperty(propDef, type, typeDeser,
beanDesc.getClassAnnotations(), (AnnotatedMethod) mutator);
} else {
// 08-Sep-2016, tatu: wonder if we should verify it is `AnnotatedField` to be safe?
prop = new FieldProperty(propDef, type, typeDeser,
beanDesc.getClassAnnotations(), (AnnotatedField) mutator);
}
JsonDeserializer<?> deser = findDeserializerFromAnnotation(ctxt, mutator);
if (deser == null) {
deser = type.getValueHandler();
}
if (deser != null) {
deser = ctxt.handlePrimaryContextualization(deser, prop, type);
prop = prop.withValueDeserializer(deser);
}
// need to retain name of managed forward references:
AnnotationIntrospector.ReferenceProperty ref = propDef.findReferenceType();
if (ref != null && ref.isManagedReference()) {
prop.setManagedReferenceName(ref.getName());
}
ObjectIdInfo objectIdInfo = propDef.findObjectIdInfo();
if (objectIdInfo != null){
prop.
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>setObjectIdInfo(objectIdInfo);
}
return prop;
}
/**
* Method that will construct a regular bean property setter using
* the given setter method.
*/
protected SettableBeanProperty constructSetterlessProperty(DeserializationContext ctxt,
BeanDescription beanDesc, BeanPropertyDefinition propDef)
throws JsonMappingException
{
final AnnotatedMethod getter = propDef.getGetter();
JavaType type = resolveMemberAndTypeAnnotations(ctxt, getter, getter.getType());
TypeDeserializer typeDeser = type.getTypeHandler();
SettableBeanProperty prop = new SetterlessProperty(propDef, type, typeDeser,
beanDesc.getClassAnnotations(), getter);
JsonDeserializer<?> deser = findDeserializerFromAnnotation(ctxt, getter);
if (deser == null) {
deser = type.getValueHandler();
}
if (deser != null) {
deser = ctxt.handlePrimaryContextualization(deser, prop, type);
prop = prop.withValueDeserializer(deser);
}
return prop;
}
/*
/**********************************************************
/* Helper methods for Bean deserializer, other
/**********************************************************
*/
/**
* Helper method used to skip processing for types that we know
* can not be (i.e. are never consider to be) beans:
* things like primitives, Arrays, Enums, and proxy types.
*<p>
* Note that usually we shouldn't really be getting these sort of
* types anyway; but better safe than sorry.
*/
protected boolean isPotentialBeanType(Class<?> type)
{
String typeStr = ClassUtil.canBeABeanType(type);
if (typeStr != null) {
throw new IllegalArgumentException("Can not deserialize Class "+type.getName()+" (of type "+typeStr+") as a Bean");
}
if (ClassUtil.isProxyType(type)) {
throw new IllegalArgumentException("Can not deserialize Proxy class "+type.getName()+" as a Bean");
}
/* also: can't deserialize some local classes: static are ok; in-method not;
* other non-static inner classes are ok
*/
typeStr = ClassUtil.isLocalType(type, true);
if (typeStr != null) {
throw new IllegalArgumentException("Can not deserialize Class "+type.getName()+" (of type "+typeStr+") as a
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>SerializerFactory f) {
super(src, config, f);
}
protected DefaultSerializerProvider(DefaultSerializerProvider src) {
super(src);
}
/**
* Method that sub-classes need to implement: used to create a non-blueprint instances
* from the blueprint.
* This is needed to retain state during serialization.
*/
public abstract DefaultSerializerProvider createInstance(SerializationConfig config,
SerializerFactory jsf);
/**
* Method needed to ensure that {@link ObjectMapper#copy} will work
* properly; specifically, that caches are cleared, but settings
* will otherwise remain identical; and that no sharing of state
* occurs.
*
* @since 2.5
*/
public DefaultSerializerProvider copy() {
throw new IllegalStateException("DefaultSerializerProvider sub-class not overriding copy()");
}
/*
/**********************************************************
/* Abstract method impls, factory methods
/**********************************************************
*/
@Override
public JsonSerializer<Object> serializerInstance(Annotated annotated, Object serDef) throws JsonMappingException
{
if (serDef == null) {
return null;
}
JsonSerializer<?> ser;
if (serDef instanceof JsonSerializer) {
ser = (JsonSerializer<?>) serDef;
} else {
/* Alas, there's no way to force return type of "either class
* X or Y" -- need to throw an exception after the fact
*/
if (!(serDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned serializer definition of type "
+serDef.getClass().getName()+"; expected type JsonSerializer or Class<JsonSerializer> instead");
}
Class<?> serClass = (Class<?>)serDef;
// there are some known "no class" markers to consider too:
if (serClass == JsonSerializer.None.class || ClassUtil.isBogusClass(serClass)) {
return null;
}
if (!JsonSerializer.class.isAssignableFrom(serClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "
+serClass.getName()+"; expected Class<JsonSerializer>");
}
HandlerInstantiator hi = _config.getHandlerInstantiator();
ser = (hi == null) ? null : hi.serializerInstance(_config, annotated, serClass);
if (ser == null) {
ser = (JsonSerializer<?>) ClassUtil.createInstance(
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> if (rootName == null) { // not explicitly specified
wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE);
if (wrap) {
gen.writeStartObject();
PropertyName pname = _config.findRootName(value.getClass());
gen.writeFieldName(pname.simpleAsEncoded(_config));
}
} else if (rootName.isEmpty()) {
wrap = false;
} else { // [JACKSON-764]
// empty String means explicitly disabled; non-empty that it is enabled
wrap = true;
gen.writeStartObject();
gen.writeFieldName(rootName.getSimpleName());
}
try {
ser.serialize(value, gen, this);
if (wrap) {
gen.writeEndObject();
}
} catch (IOException ioe) { // As per [JACKSON-99], pass IOException and subtypes as-is
throw ioe;
} catch (Exception e) { // but wrap RuntimeExceptions, to get path information
String msg = e.getMessage();
if (msg == null) {
msg = "[no message for "+e.getClass().getName()+"]";
}
throw new JsonMappingException(gen, msg, e);
}
}
/**
* The method to be called by {@link ObjectMapper} and {@link ObjectWriter}
* for serializing given value (assumed to be of specified root type,
* instead of runtime type of value),
* using serializers that
* this provider has access to (via caching and/or creating new serializers
* as need be),
*
* @param rootType Type to use for locating serializer to use, instead of actual
* runtime type. Must be actual type, or one of its super types
*/
public void serializeValue(JsonGenerator gen, Object value, JavaType rootType) throws IOException
{
_generator = gen;
if (value == null) {
_serializeNull(gen);
return;
}
// Let's ensure types are compatible at this point
if (!rootType.getRawClass().isAssignableFrom(value.getClass())) {
_reportIncompatibleRootType(value, rootType);
}
// root value, not reached via property:
JsonSerializer<Object> ser = findTypedValueSerializer(rootType, true, null);
//
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> Ok: should we wrap result in an additional property ("root name")?
final boolean wrap;
PropertyName rootName = _config.getFullRootName();
if (rootName == null) { // not explicitly specified
wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE);
if (wrap) {
gen.writeStartObject();
PropertyName pname = _config.findRootName(value.getClass());
gen.writeFieldName(pname.simpleAsEncoded(_config));
}
} else if (rootName.isEmpty()) {
wrap = false;
} else {
// empty String means explicitly disabled; non-empty that it is enabled
wrap = true;
gen.writeStartObject();
gen.writeFieldName(rootName.getSimpleName());
}
try {
ser.serialize(value, gen, this);
if (wrap) {
gen.writeEndObject();
}
} catch (IOException ioe) { // no wrapping for IO (and derived)
throw ioe;
} catch (Exception e) { // but others do need to be, to get path etc
String msg = e.getMessage();
if (msg == null) {
msg = "[no message for "+e.getClass().getName()+"]";
}
reportMappingProblem(e, msg);
}
}
/**
* The method to be called by {@link ObjectWriter}
* for serializing given value (assumed to be of specified root type,
* instead of runtime type of value), when it may know specific
* {@link JsonSerializer} to use.
*
* @param rootType Type to use for locating serializer to use, instead of actual
* runtime type, if no serializer is passed
* @param ser Root Serializer to use, if not null
*
* @since 2.1
*/
public void serializeValue(JsonGenerator gen, Object value, JavaType rootType,
JsonSerializer<Object> ser) throws IOException
{
_generator = gen;
if (value == null) {
_serializeNull(gen);
return;
}
// Let's ensure types are compatible at this point
if ((rootType != null) && !rootType.getRawClass().isAssignableFrom(value.getClass())) {
_reportIncompatibleRootType(value, rootType);
}
// root value, not
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> reached via property:
if (ser == null) {
ser = findTypedValueSerializer(rootType, true, null);
}
// Ok: should we wrap result in an additional property ("root name")?
final boolean wrap;
PropertyName rootName = _config.getFullRootName();
if (rootName == null) { // not explicitly specified
// [JACKSON-163]
wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE);
if (wrap) {
gen.writeStartObject();
PropertyName pname = (rootType == null)
? _config.findRootName(value.getClass())
: _config.findRootName(rootType);
gen.writeFieldName(pname.simpleAsEncoded(_config));
}
} else if (rootName.isEmpty()) {
wrap = false;
} else { // [JACKSON-764]
// empty String means explicitly disabled; non-empty that it is enabled
wrap = true;
gen.writeStartObject();
gen.writeFieldName(rootName.getSimpleName());
}
try {
ser.serialize(value, gen, this);
if (wrap) {
gen.writeEndObject();
}
} catch (IOException ioe) { // no wrapping for IO (and derived)
throw ioe;
} catch (Exception e) { // but others do need to be, to get path etc
String msg = e.getMessage();
if (msg == null) {
msg = "[no message for "+e.getClass().getName()+"]";
}
reportMappingProblem(e, msg);
}
}
/**
* Alternate serialization call used for polymorphic types, when {@link TypeSerializer}
* is already known, but the actual serializer may or may not be.
*
* @since 2.6
*/
public void serializePolymorphic(JsonGenerator gen, Object value, JavaType rootType,
JsonSerializer<Object> valueSer, TypeSerializer typeSer)
throws IOException
{
_generator = gen;
if (value == null) {
_serializeNull(gen);
return;
}
// Let's ensure types are compatible at this point
if ((rootType != null) && !rootType.getRawClass().isAssignableFrom(value.getClass())) {
_reportIncompatible
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>RootType(value, rootType);
}
/* 12-Jun-2015, tatu: nominal root type is necessary for Maps at least;
* possibly collections, but can cause problems for other polymorphic
* types. We really need to distinguish between serialization type,
* base type; but right we don't. Hence this check
*/
if (valueSer == null) {
if ((rootType != null) && rootType.isContainerType()) {
valueSer = findValueSerializer(rootType, null);
} else {
valueSer = findValueSerializer(value.getClass(), null);
}
}
final boolean wrap;
PropertyName rootName = _config.getFullRootName();
if (rootName == null) {
wrap = _config.isEnabled(SerializationFeature.WRAP_ROOT_VALUE);
if (wrap) {
gen.writeStartObject();
PropertyName pname = _config.findRootName(value.getClass());
gen.writeFieldName(pname.simpleAsEncoded(_config));
}
} else if (rootName.isEmpty()) {
wrap = false;
} else {
wrap = true;
gen.writeStartObject();
gen.writeFieldName(rootName.getSimpleName());
}
try {
valueSer.serializeWithType(value, gen, this, typeSer);
if (wrap) {
gen.writeEndObject();
}
} catch (IOException ioe) { // no wrapping for IO (and derived)
throw ioe;
} catch (Exception e) { // but others do need to be, to get path etc
String msg = e.getMessage();
if (msg == null) {
msg = "[no message for "+e.getClass().getName()+"]";
}
reportMappingProblem(e, msg);
}
}
/**
* @deprecated since 2.6; remove from 2.7 or later
*/
@Deprecated
public void serializePolymorphic(JsonGenerator gen, Object value, TypeSerializer typeSer)
throws IOException
{
JavaType t = (value == null) ? null : _config.constructType(value.getClass());
serializePolymorphic(gen, value, t, null, typeSer);
}
/**
* Helper method called when root value to serialize is null
*
* @
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>since 2.3
*/
protected void _serializeNull(JsonGenerator gen) throws IOException
{
JsonSerializer<Object> ser = getDefaultNullValueSerializer();
try {
ser.serialize(null, gen, this);
} catch (IOException ioe) { // no wrapping for IO (and derived)
throw ioe;
} catch (Exception e) { // but others do need to be, to get path etc
String msg = e.getMessage();
if (msg == null) {
msg = "[no message for "+e.getClass().getName()+"]";
}
reportMappingProblem(e, msg);
}
}
/*
/********************************************************
/* Access to caching details
/********************************************************
*/
/**
* Method that can be used to determine how many serializers this
* provider is caching currently
* (if it does caching: default implementation does)
* Exact count depends on what kind of serializers get cached;
* default implementation caches all serializers, including ones that
* are eagerly constructed (for optimal access speed)
*<p>
* The main use case for this method is to allow conditional flushing of
* serializer cache, if certain number of entries is reached.
*/
public int cachedSerializersCount() {
return _serializerCache.size();
}
/**
* Method that will drop all serializers currently cached by this provider.
* This can be used to remove memory usage (in case some serializers are
* only used once or so), or to force re-construction of serializers after
* configuration changes for mapper than owns the provider.
*/
public void flushCachedSerializers() {
_serializerCache.flush();
}
/*
/**********************************************************
/* Extended API called by ObjectMapper: other
/**********************************************************
*/
/**
* The method to be called by {@link ObjectMapper} and {@link ObjectWriter}
* to to expose the format of the given to to the given visitor
*
* @param javaType The type for which to generate format
* @param visitor the visitor to accept the format
*/
public void acceptJsonFormatVisitor(JavaType javaType, JsonFormatVisitorWrapper visitor)
throws JsonMappingException
{
if (javaType == null) {
throw new IllegalArgumentException("A class must be provided");
}
/* no need for embedded type information for JSON schema generation (all
* type information it needs
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> is accessible via "untyped" serializer)
*/
visitor.setProvider(this);
findValueSerializer(javaType, null).acceptJsonFormatVisitor(visitor, javaType);
}
/**
* The method to be called by {@link ObjectMapper}
* to generate <a href="http://json-schema.org/">JSON schema</a> for
* given type.
*
* @param type The type for which to generate schema
*
* @deprecated Should not be used any more
*/
@Deprecated // since 2.6
public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class<?> type)
throws JsonMappingException
{
if (type == null) {
throw new IllegalArgumentException("A class must be provided");
}
/* no need for embedded type information for JSON schema generation (all
* type information it needs is accessible via "untyped" serializer)
*/
JsonSerializer<Object> ser = findValueSerializer(type, null);
JsonNode schemaNode = (ser instanceof SchemaAware) ?
((SchemaAware) ser).getSchema(this, null) : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode();
if (!(schemaNode instanceof ObjectNode)) {
throw new IllegalArgumentException("Class " + type.getName()
+" would not be serialized as a JSON object and therefore has no schema");
}
return new com.fasterxml.jackson.databind.jsonschema.JsonSchema((ObjectNode) schemaNode);
}
/*
/**********************************************************
/* Helper classes
/**********************************************************
*/
/**
* Concrete implementation that defines factory method(s),
* defined as final.
*/
public final static class Impl extends DefaultSerializerProvider {
private static final long serialVersionUID = 1L;
public Impl() { super(); }
public Impl(Impl src) { super(src); }
protected Impl(SerializerProvider src, SerializationConfig config,
SerializerFactory f) {
super(src, config, f);
}
@Override
public DefaultSerializerProvider copy()
{
if (getClass() != Impl.class) {
return super.copy();
}
return new Impl(this);
}
@Override
public Impl createInstance(SerializationConfig config, SerializerFactory jsf) {
return new Impl(this, config
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> throw new IllegalArgumentException("Null SerializerProvider passed for "+handledType().getName());
}
return false;
}
protected void _acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint,
boolean asNumber) throws JsonMappingException
{
if (asNumber) {
visitIntFormat(visitor, typeHint,
JsonParser.NumberType.LONG, JsonValueFormat.UTC_MILLISEC);
} else {
visitStringFormat(visitor, typeHint, JsonValueFormat.DATE_TIME);
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>) {
return "UNKNOWN";
}
return cls.getName();
}
/**
* Method that will return true if any of <code>canCreateXxx</code> method
* returns true: that is, if there is any way that an instance could
* be created.
*/
public boolean canInstantiate() {
return canCreateUsingDefault() || canCreateUsingDelegate()
|| canCreateFromObjectWith() || canCreateFromString()
|| canCreateFromInt() || canCreateFromLong()
|| canCreateFromDouble() || canCreateFromBoolean();
}
/**
* Method that can be called to check whether a String-based creator
* is available for this instantiator
*/
public boolean canCreateFromString() { return false; }
/**
* Method that can be called to check whether an integer (int, Integer) based
* creator is available to use (to call {@link #createFromInt}).
*/
public boolean canCreateFromInt() { return false; }
/**
* Method that can be called to check whether a long (long, Long) based
* creator is available to use (to call {@link #createFromLong}).
*/
public boolean canCreateFromLong() { return false; }
/**
* Method that can be called to check whether a double (double / Double) based
* creator is available to use (to call {@link #createFromDouble}).
*/
public boolean canCreateFromDouble() { return false; }
/**
* Method that can be called to check whether a double (boolean / Boolean) based
* creator is available to use (to call {@link #createFromDouble}).
*/
public boolean canCreateFromBoolean() { return false; }
/**
* Method that can be called to check whether a default creator (constructor,
* or no-arg static factory method)
* is available for this instantiator
*/
public boolean canCreateUsingDefault() { return getDefaultCreator() != null; }
/**
* Method that can be called to check whether a delegate-based creator (single-arg
* constructor or factory method)
* is available for this instantiator
*/
public boolean canCreateUsingDelegate() { return false; }
/**
* Method that can be called to check whether a array-delegate-based creator
* (single-arg constructor or factory method)
* is available for this instantiator
*
*
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> {
return createFromBoolean(ctxt, true);
}
if ("false".equals(str)) {
return createFromBoolean(ctxt, false);
}
}
// also, empty Strings might be accepted as null Object...
if (value.length() == 0) {
if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) {
return null;
}
}
return ctxt.handleMissingInstantiator(getValueClass(), ctxt.getParser(),
"no String-argument constructor/factory method to deserialize from String value ('%s')",
value);
}
/*
/**********************************************************
/* Standard Base implementation (since 2.8)
/**********************************************************
*/
/**
* Partial {@link ValueInstantiator} implementation that is strongly recommended
* to be used instead of directly extending {@link ValueInstantiator} itself.
*/
public static class Base extends ValueInstantiator
{
protected final Class<?> _valueType;
public Base(Class<?> type) {
_valueType = type;
}
public Base(JavaType type) {
_valueType = type.getRawClass();
}
@Override
public String getValueTypeDesc() {
return _valueType.getName();
}
@Override
public Class<?> getValueClass() {
return _valueType;
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.*;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.util.ClassUtil;
public final class AnnotatedMethod
extends AnnotatedWithParams
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
final protected transient Method _method;
// // Simple lazy-caching:
protected Class<?>[] _paramClasses;
/**
* Field that is used to make JDK serialization work with this
* object.
*
* @since 2.1
*/
protected Serialization _serialization;
/*
/*****************************************************
/* Life-cycle
/*****************************************************
*/
public AnnotatedMethod(TypeResolutionContext ctxt, Method method,
AnnotationMap classAnn, AnnotationMap[] paramAnnotations)
{
super(ctxt, classAnn, paramAnnotations);
if (method == null) {
throw new IllegalArgumentException("Can not construct AnnotatedMethod with null Method");
}
_method = method;
}
/**
* Method used for JDK serialization support
* @since 2.1
*/
protected AnnotatedMethod(Serialization ser)
{
super(null, null, null);
_method = null;
_serialization = ser;
}
/**
* Method that constructs a new instance with settings (annotations, parameter annotations)
* of this instance, but with different physical {@link Method}.
*/
public AnnotatedMethod withMethod(Method m) {
return new AnnotatedMethod(_typeContext, m, _annotations, _paramAnnotations);
}
@Override
public AnnotatedMethod withAnnotations(AnnotationMap ann) {
return new AnnotatedMethod(_typeContext, _method, ann, _paramAnnotations);
}
@Override
public Method getAnnotated() { return _method; }
@Override
public int getModifiers() { return _method.getModifiers(); }
@Override
public String getName() { return _method.getName(); }
/**
* For methods, this returns declared return type, which is only
* useful with getters (setters do not return anything; hence `Void`
* would be returned here)
*/
@Override
public JavaType getType() {
return _typeContext.resolveType(_method.getGenericReturnType());
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>, value);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Failed to setValue() with method "
+getFullName()+": "+e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("Failed to setValue() with method "
+getFullName()+": "+e.getMessage(), e);
}
}
@Override
public Object getValue(Object pojo) throws IllegalArgumentException
{
try {
return _method.invoke(pojo);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Failed to getValue() with method "
+getFullName()+": "+e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("Failed to getValue() with method "
+getFullName()+": "+e.getMessage(), e);
}
}
/*
/*****************************************************
/* Extended API, generic
/*****************************************************
*/
public String getFullName() {
return getDeclaringClass().getName() + "#" + getName() + "("
+getParameterCount()+" params)";
}
public Class<?>[] getRawParameterTypes()
{
if (_paramClasses == null) {
_paramClasses = _method.getParameterTypes();
}
return _paramClasses;
}
@Deprecated // since 2.7
public Type[] getGenericParameterTypes() {
return _method.getGenericParameterTypes();
}
public Class<?> getRawReturnType() {
return _method.getReturnType();
}
/**
* Helper method that can be used to check whether method returns
* a value or not; if return type declared as <code>void</code>, returns
* false, otherwise true
*
* @since 2.4
*/
public boolean hasReturnType() {
Class<?> rt = getRawReturnType();
return (rt != Void.TYPE && rt != Void.class);
}
/*
/********************************************************
/* Other
/********************************************************
*/
@Override
public String toString() {
return "[method "+getFullName()+"]";
}
@Override
public int hashCode() {
return _method.getName().hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
return ((AnnotatedMethod) o)._method == _method;
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
/*
/**********************************************************
/* JDK serialization handling
/**********************************************************
*/
Object writeReplace() {
return new AnnotatedMethod(new Serialization(_method));
}
Object readResolve() {
Class<?> clazz = _serialization.clazz;
try {
Method m = clazz.getDeclaredMethod(_serialization.name,
_serialization.args);
// 06-Oct-2012, tatu: Has "lost" its security override, may need to force back
if (!m.isAccessible()) {
ClassUtil.checkAndFixAccess(m, false);
}
return new AnnotatedMethod(null, m, null, null);
} catch (Exception e) {
throw new IllegalArgumentException("Could not find method '"+_serialization.name
+"' from Class '"+clazz.getName());
}
}
/**
* Helper class that is used as the workaround to persist
* Field references. It basically just stores declaring class
* and field name.
*/
private final static class Serialization
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected Class<?> clazz;
protected String name;
protected Class<?>[] args;
public Serialization(Method setter) {
clazz = setter.getDeclaringClass();
name = setter.getName();
args = setter.getParameterTypes();
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> references,
* not instances
*/
protected final static HashMap<String, Class<? extends JsonSerializer<?>>> _concreteLazy;
static {
HashMap<String, Class<? extends JsonSerializer<?>>> concLazy
= new HashMap<String, Class<? extends JsonSerializer<?>>>();
HashMap<String, JsonSerializer<?>> concrete
= new HashMap<String, JsonSerializer<?>>();
/* String and string-like types (note: date types explicitly
* not included -- can use either textual or numeric serialization)
*/
concrete.put(String.class.getName(), new StringSerializer());
final ToStringSerializer sls = ToStringSerializer.instance;
concrete.put(StringBuffer.class.getName(), sls);
concrete.put(StringBuilder.class.getName(), sls);
concrete.put(Character.class.getName(), sls);
concrete.put(Character.TYPE.getName(), sls);
// Primitives/wrappers for primitives (primitives needed for Beans)
NumberSerializers.addAll(concrete);
concrete.put(Boolean.TYPE.getName(), new BooleanSerializer(true));
concrete.put(Boolean.class.getName(), new BooleanSerializer(false));
// Other numbers, more complicated
concrete.put(BigInteger.class.getName(), new NumberSerializer(BigInteger.class));
concrete.put(BigDecimal.class.getName(),new NumberSerializer(BigDecimal.class));
// Other discrete non-container types:
// First, Date/Time zoo:
concrete.put(Calendar.class.getName(), CalendarSerializer.instance);
concrete.put(java.util.Date.class.getName(), DateSerializer.instance);
// And then other standard non-structured JDK types
for (Map.Entry<Class<?>,Object> en : StdJdkSerializers.all()) {
Object value = en.getValue();
if (value instanceof JsonSerializer<?>) {
concrete.put(en.getKey().getName(), (JsonSerializer<?>) value);
} else if (value instanceof Class<?>) {
@SuppressWarnings("unchecked")
Class<? extends JsonSerializer<?>> cls = (Class<? extends JsonSerializer<?>>) value;
concLazy.put(en.getKey().getName(), cls);
} else { // should never happen, but:
throw new IllegalStateException("Internal error: unrecognized value of type "+en.getClass().getName());
}
}
// Jackson-specific type(s)
// (
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Q: can this ever be sub-classed?)
concLazy.put(TokenBuffer.class.getName(), TokenBufferSerializer.class);
_concrete = concrete;
_concreteLazy = concLazy;
}
/*
/**********************************************************
/* Configuration
/**********************************************************
*/
/**
* Configuration settings for this factory; immutable instance (just like this
* factory), new version created via copy-constructor (fluent-style)
*/
protected final SerializerFactoryConfig _factoryConfig;
/*
/**********************************************************
/* Life cycle
/**********************************************************
*/
/**
* We will provide default constructor to allow sub-classing,
* but make it protected so that no non-singleton instances of
* the class will be instantiated.
*/
protected BasicSerializerFactory(SerializerFactoryConfig config) {
_factoryConfig = (config == null) ? new SerializerFactoryConfig() : config;
}
/**
* Method for getting current {@link SerializerFactoryConfig}.
*<p>
* Note that since instances are immutable, you can NOT change settings
* by accessing an instance and calling methods: this will simply create
* new instance of config object.
*/
public SerializerFactoryConfig getFactoryConfig() {
return _factoryConfig;
}
/**
* Method used for creating a new instance of this factory, but with different
* configuration. Reason for specifying factory method (instead of plain constructor)
* is to allow proper sub-classing of factories.
*<p>
* Note that custom sub-classes generally <b>must override</b> implementation
* of this method, as it usually requires instantiating a new instance of
* factory type. Check out javadocs for
* {@link com.fasterxml.jackson.databind.ser.BeanSerializerFactory} for more details.
*/
public abstract SerializerFactory withConfig(SerializerFactoryConfig config);
/**
* Convenience method for creating a new factory instance with an additional
* serializer provider.
*/
@Override
public final SerializerFactory withAdditionalSerializers(Serializers additional) {
return withConfig(_factoryConfig.withAdditionalSerializers(additional));
}
/**
* Convenience method for creating a new factory instance with an additional
* key serializer provider.
*/
@Override
public final SerializerFactory withAdditionalKeySerializers(Serializers additional) {
return withConfig(_factoryConfig.with
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Class();
String clsName = raw.getName();
JsonSerializer<?> ser = _concrete.get(clsName);
if (ser == null) {
Class<? extends JsonSerializer<?>> serClass = _concreteLazy.get(clsName);
if (serClass != null) {
try {
return serClass.newInstance();
} catch (Exception e) {
throw new IllegalStateException("Failed to instantiate standard serializer (of type "+serClass.getName()+"): "
+e.getMessage(), e);
}
}
}
return ser;
}
/**
* Method called to see if one of primary per-class annotations
* (or related, like implementing of {@link JsonSerializable})
* determines the serializer to use.
*<p>
* Currently handles things like:
*<ul>
* <li>If type implements {@link JsonSerializable}, use that
* </li>
* <li>If type has {@link com.fasterxml.jackson.annotation.JsonValue} annotation (or equivalent), build serializer
* based on that property
* </li>
*</ul>
*
* @since 2.0
*/
protected final JsonSerializer<?> findSerializerByAnnotations(SerializerProvider prov,
JavaType type, BeanDescription beanDesc)
throws JsonMappingException
{
Class<?> raw = type.getRawClass();
// First: JsonSerializable?
if (JsonSerializable.class.isAssignableFrom(raw)) {
return SerializableSerializer.instance;
}
// Second: @JsonValue for any type
AnnotatedMethod valueMethod = beanDesc.findJsonValueMethod();
if (valueMethod != null) {
Method m = valueMethod.getAnnotated();
if (prov.canOverrideAccessModifiers()) {
ClassUtil.checkAndFixAccess(m, prov.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
JsonSerializer<Object> ser = findSerializerFromAnnotation(prov, valueMethod);
return new JsonValueSerializer(valueMethod, ser);
}
// No well-known annotations...
return null;
}
/**
* Method for checking if we can determine serializer to use based on set of
* known primary types, checking for set of known base types (exact matches
* having been compared against with <code>findSerializerByLookup</code>).
* This does not include "secondary" interfaces
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>getAnnotationIntrospector().findFilterId((Annotated)beanDesc.getClassInfo());
}
/**
* Helper method to check whether global settings and/or class
* annotations for the bean class indicate that static typing
* (declared types) should be used for properties.
* (instead of dynamic runtime types).
*
* @since 2.1 (earlier had variant with additional 'property' parameter)
*/
protected boolean usesStaticTyping(SerializationConfig config,
BeanDescription beanDesc, TypeSerializer typeSer)
{
/* 16-Aug-2010, tatu: If there is a (value) type serializer, we can not force
* static typing; that would make it impossible to handle expected subtypes
*/
if (typeSer != null) {
return false;
}
AnnotationIntrospector intr = config.getAnnotationIntrospector();
JsonSerialize.Typing t = intr.findSerializationTyping(beanDesc.getClassInfo());
if (t != null && t != JsonSerialize.Typing.DEFAULT_TYPING) {
return (t == JsonSerialize.Typing.STATIC);
}
return config.isEnabled(MapperFeature.USE_STATIC_TYPING);
}
protected Class<?> _verifyAsClass(Object src, String methodName, Class<?> noneClass)
{
if (src == null) {
return null;
}
if (!(src instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector."+methodName+"() returned value of type "+src.getClass().getName()+": expected type JsonSerializer or Class<JsonSerializer> instead");
}
Class<?> cls = (Class<?>) src;
if (cls == noneClass || ClassUtil.isBogusClass(cls)) {
return null;
}
return cls;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> {
String str = "DateFormat "+getClass().getName();
TimeZone tz = _timezone;
if (tz != null) {
str += " (timezone: "+tz+")";
}
str += "(locale: "+_locale+")";
return str;
}
@Override // since 2.7[.2], as per [databind#1130]
public boolean equals(Object o) {
return (o == this);
}
@Override // since 2.7[.2], as per [databind#1130]
public int hashCode() {
return System.identityHashCode(this);
}
/*
/**********************************************************
/* Helper methods
/**********************************************************
*/
/**
* Overridable helper method used to figure out which of supported
* formats is the likeliest match.
*/
protected boolean looksLikeISO8601(String dateStr)
{
if (dateStr.length() >= 5
&& Character.isDigit(dateStr.charAt(0))
&& Character.isDigit(dateStr.charAt(3))
&& dateStr.charAt(4) == '-'
) {
return true;
}
return false;
}
protected Date parseAsISO8601(String dateStr, ParsePosition pos, boolean throwErrors)
throws ParseException
{
/* 21-May-2009, tatu: DateFormat has very strict handling of
* timezone modifiers for ISO-8601. So we need to do some scrubbing.
*/
/* First: do we have "zulu" format ('Z' == "UTC")? If yes, that's
* quite simple because we already set date format timezone to be
* UTC, and hence can just strip out 'Z' altogether
*/
int len = dateStr.length();
char c = dateStr.charAt(len-1);
DateFormat df;
String formatStr;
// Need to support "plain" date...
if (len <= 10 && Character.isDigit(c)) {
df = _formatPlain;
formatStr = DATE_FORMAT_STR_PLAIN;
if (df == null) {
df = _formatPlain = _cloneFormat(DATE_FORMAT_PLAIN, formatStr,
_timezone, _locale,
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>[i].getName();
// Need to consider Injectables, which may not have
// a name at all, and need to be skipped
if (name.length() == 0
&& properties[i].getInjectableValueId() != null) {
continue;
}
Integer old = names.put(name, Integer.valueOf(i));
if (old != null) {
throw new IllegalArgumentException(String.format(
"Duplicate creator property \"%s\" (index %s vs %d)",
name, old, i));
}
}
}
_propertyBasedArgs = properties;
}
}
public void addIncompeteParameter(AnnotatedParameter parameter) {
if (_incompleteParameter == null) {
_incompleteParameter = parameter;
}
}
// Bunch of methods deprecated in 2.5, to be removed from 2.6 or later
@Deprecated // since 2.5
public void addStringCreator(AnnotatedWithParams creator) {
addStringCreator(creator, false);
}
@Deprecated // since 2.5
public void addIntCreator(AnnotatedWithParams creator) {
addBooleanCreator(creator, false);
}
@Deprecated // since 2.5
public void addLongCreator(AnnotatedWithParams creator) {
addBooleanCreator(creator, false);
}
@Deprecated // since 2.5
public void addDoubleCreator(AnnotatedWithParams creator) {
addBooleanCreator(creator, false);
}
@Deprecated // since 2.5
public void addBooleanCreator(AnnotatedWithParams creator) {
addBooleanCreator(creator, false);
}
@Deprecated // since 2.5
public void addDelegatingCreator(AnnotatedWithParams creator,
CreatorProperty[] injectables) {
addDelegatingCreator(creator, false, injectables);
}
@Deprecated // since 2.5
public void addPropertyCreator(AnnotatedWithParams creator,
CreatorProperty[] properties) {
addPropertyCreator(creator, false, properties);
}
/*
* /********************************************************** /* Accessors
* /**********************************************************
*/
/**
* @since 2.1
*/
public boolean hasDefaultCreator() {
return _creators[C_DEFAULT] != null;
}
/**
* @since 2.6
*/
public boolean has
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> = newOne.getRawParameterType(0);
if (oldType == newType) {
// 13-Jul-2016, tatu: One more thing to check; since Enum
// classes always have
// implicitly created `valueOf()`, let's resolve in favor of
// other implicit
// creator (`fromString()`)
if (_isEnumValueOf(newOne)) {
return false; // ignore
}
if (_isEnumValueOf(oldOne)) {
;
} else {
throw new IllegalArgumentException(String.format(
"Conflicting %s creators: already had %s creator %s, encountered another: %s",
TYPE_DESCS[typeIndex],
explicit ? "explicitly marked"
: "implicitly discovered",
oldOne, newOne));
}
}
// otherwise, which one to choose?
else if (newType.isAssignableFrom(oldType)) {
// new type more generic, use old
return false;
}
// new type more specific, use it
}
}
if (explicit) {
_explicitCreators |= mask;
}
_creators[typeIndex] = _fixAccess(newOne);
return true;
}
/**
* Helper method for recognizing `Enum.valueOf()` factory method
*
* @since 2.8.1
*/
protected boolean _isEnumValueOf(AnnotatedWithParams creator) {
return creator.getDeclaringClass().isEnum()
&& "valueOf".equals(creator.getName());
}
/*
/**********************************************************
/* Helper class(es)
/**********************************************************
*/
/**
* Replacement for default constructor to use for a small set of
* "well-known" types.
* <p>
* Note: replaces earlier <code>Vanilla</code>
* <code>ValueInstantiator</code> implementation
*
* @since 2.8.1 (replacing earlier <code>Vanilla</code> instantiator
*/
protected final static class StdTypeConstructor extends AnnotatedWithParams
implements java.io.Serializable {
private static final long serialVersionUID = 1L;
public final static int TYPE_ARRAY_LIST = 1;
public final static int TYPE_HASH_MAP = 2;
public final static int TYPE_LINKED_HASH_MAP =
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>, IllegalArgumentException {
throw new UnsupportedOperationException();
}
@Override
public Object getValue(Object pojo)
throws UnsupportedOperationException, IllegalArgumentException {
throw new UnsupportedOperationException();
}
@Override
public Annotated withAnnotations(AnnotationMap fallback) {
throw new UnsupportedOperationException();
}
@Override
public AnnotatedElement getAnnotated() {
return _base.getAnnotated();
}
@Override
protected int getModifiers() {
return _base.getMember().getModifiers();
}
@Override
public String getName() {
return _base.getName();
}
@Override
public JavaType getType() {
return _base.getType();
}
@Override
public Class<?> getRawType() {
return _base.getRawType();
}
@Override
public boolean equals(Object o) {
return (o == this);
}
@Override
public int hashCode() {
return _base.hashCode();
}
@Override
public String toString() {
return _base.toString();
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>since 2.4.6
*/
private boolean _hasCustomValueHandler(JavaType t) {
if (t.isContainerType()) {
JavaType ct = t.getContentType();
if (ct != null) {
return (ct.getValueHandler() != null) || (ct.getTypeHandler() != null);
}
}
return false;
}
private Class<?> _verifyAsClass(Object src, String methodName, Class<?> noneClass)
{
if (src == null) {
return null;
}
if (!(src instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector."+methodName+"() returned value of type "+src.getClass().getName()+": expected type JsonSerializer or Class<JsonSerializer> instead");
}
Class<?> cls = (Class<?>) src;
if (cls == noneClass || ClassUtil.isBogusClass(cls)) {
return null;
}
return cls;
}
/*
/**********************************************************
/* Overridable error reporting methods
/**********************************************************
*/
// NOTE: changed 2.6 -> 2.7 to pass context; no way to make backwards compatible
protected JsonDeserializer<Object> _handleUnknownValueDeserializer(DeserializationContext ctxt, JavaType type)
throws JsonMappingException
{
/* Let's try to figure out the reason, to give better error
* messages
*/
Class<?> rawClass = type.getRawClass();
if (!ClassUtil.isConcrete(rawClass)) {
ctxt.reportMappingException("Can not find a Value deserializer for abstract type %s", type);
}
ctxt.reportMappingException("Can not find a Value deserializer for type %s", type);
return null;
}
protected KeyDeserializer _handleUnknownKeyDeserializer(DeserializationContext ctxt, JavaType type)
throws JsonMappingException
{
ctxt.reportMappingException("Can not find a (Map) Key deserializer for type %s", type);
return null;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>("unchecked")
public StdDelegatingSerializer(Converter<Object,?> converter,
JavaType delegateType, JsonSerializer<?> delegateSerializer)
{
super(delegateType);
_converter = converter;
_delegateType = delegateType;
_delegateSerializer = (JsonSerializer<Object>) delegateSerializer;
}
/**
* Method used for creating resolved contextual instances. Must be
* overridden when sub-classing.
*/
protected StdDelegatingSerializer withDelegate(Converter<Object,?> converter,
JavaType delegateType, JsonSerializer<?> delegateSerializer)
{
if (getClass() != StdDelegatingSerializer.class) {
throw new IllegalStateException("Sub-class "+getClass().getName()+" must override 'withDelegate'");
}
return new StdDelegatingSerializer(converter, delegateType, delegateSerializer);
}
/*
/**********************************************************
/* Contextualization
/**********************************************************
*/
@Override
public void resolve(SerializerProvider provider) throws JsonMappingException
{
if ((_delegateSerializer != null)
&& (_delegateSerializer instanceof ResolvableSerializer)) {
((ResolvableSerializer) _delegateSerializer).resolve(provider);
}
}
@Override
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property)
throws JsonMappingException
{
JsonSerializer<?> delSer = _delegateSerializer;
JavaType delegateType = _delegateType;
if (delSer == null) {
// Otherwise, need to locate serializer to delegate to. For that we need type information...
if (delegateType == null) {
delegateType = _converter.getOutputType(provider.getTypeFactory());
}
/* 02-Apr-2015, tatu: For "dynamic case", where type is only specified as
* java.lang.Object (or missing generic), [databind#731]
*/
if (!delegateType.isJavaLangObject()) {
delSer = provider.findValueSerializer(delegateType);
}
}
if (delSer instanceof ContextualSerializer) {
delSer = provider.handleSecondaryContextualization(delSer, property);
}
if (delSer == _delegateSerializer && delegateType == _delegateType) {
return this;
}
return withDelegate(_converter, delegateType, delSer);
}
/*
/**********************************************************
/* Accessors
/**********************************************************
*/
protected Converter<
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.*;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Object that represents non-static (and usually non-transient/volatile)
* fields of a class.
*/
public final class AnnotatedField
extends AnnotatedMember
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
/**
* Actual {@link Field} used for access.
*<p>
* Transient since it can not be persisted directly using
* JDK serialization
*/
protected final transient Field _field;
/**
* Temporary field required for JDK serialization support
*/
protected Serialization _serialization;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
public AnnotatedField(TypeResolutionContext contextClass, Field field, AnnotationMap annMap)
{
super(contextClass, annMap);
_field = field;
}
@Override
public AnnotatedField withAnnotations(AnnotationMap ann) {
return new AnnotatedField(_typeContext, _field, ann);
}
/**
* Method used for JDK serialization support
*/
protected AnnotatedField(Serialization ser)
{
super(null, null);
_field = null;
_serialization = ser;
}
/*
/**********************************************************
/* Annotated impl
/**********************************************************
*/
@Override
public Field getAnnotated() { return _field; }
@Override
public int getModifiers() { return _field.getModifiers(); }
@Override
public String getName() { return _field.getName(); }
@Override
public Class<?> getRawType() {
return _field.getType();
}
@Deprecated
@Override
public Type getGenericType() {
return _field.getGenericType();
}
@Override
public JavaType getType() {
return _typeContext.resolveType(_field.getGenericType());
}
/*
/**********************************************************
/* AnnotatedMember impl
/**********************************************************
*/
@Override
public Class<?> getDeclaringClass() { return _field.getDeclaringClass(); }
@Override
public Member getMember() { return _field; }
@Override
public void setValue(Object pojo, Object
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> value) throws IllegalArgumentException
{
try {
_field.set(pojo, value);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Failed to setValue() for field "
+getFullName()+": "+e.getMessage(), e);
}
}
@Override
public Object getValue(Object pojo) throws IllegalArgumentException
{
try {
return _field.get(pojo);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Failed to getValue() for field "
+getFullName()+": "+e.getMessage(), e);
}
}
/*
/**********************************************************
/* Extended API, generic
/**********************************************************
*/
public String getFullName() {
return getDeclaringClass().getName() + "#" + getName();
}
public int getAnnotationCount() { return _annotations.size(); }
/**
* @since 2.6
*/
public boolean isTransient() { return Modifier.isTransient(getModifiers()); }
@Override
public int hashCode() {
return _field.getName().hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
return ((AnnotatedField) o)._field == _field;
}
@Override
public String toString() {
return "[field "+getFullName()+"]";
}
/*
/**********************************************************
/* JDK serialization handling
/**********************************************************
*/
Object writeReplace() {
return new AnnotatedField(new Serialization(_field));
}
Object readResolve() {
Class<?> clazz = _serialization.clazz;
try {
Field f = clazz.getDeclaredField(_serialization.name);
// 06-Oct-2012, tatu: Has "lost" its security override, may need to force back
if (!f.isAccessible()) {
ClassUtil.checkAndFixAccess(f, false);
}
return new AnnotatedField(null, f, null);
} catch (Exception e) {
throw new IllegalArgumentException("Could not find method '"+_serialization.name
+"' from Class '"+clazz.getName());
}
}
/**
* Helper class that is used as the workaround to persist
* Field references. It basically just stores declaring class
* and field name.
*/
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
private final static class Serialization
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected Class<?> clazz;
protected String name;
public Serialization(Field f) {
clazz = f.getDeclaringClass();
name = f.getName();
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> = null;
_filterId = null;
_sortKeys = false;
_suppressableValue = null;
}
/**
* @since 2.5
*/
protected void _ensureOverride() {
if (getClass() != MapSerializer.class) {
throw new IllegalStateException("Missing override in class "+getClass().getName());
}
}
@SuppressWarnings("unchecked")
protected MapSerializer(MapSerializer src, BeanProperty property,
JsonSerializer<?> keySerializer, JsonSerializer<?> valueSerializer,
Set<String> ignoredEntries)
{
super(Map.class, false);
_ignoredEntries = ((ignoredEntries == null) || ignoredEntries.isEmpty())
? null : ignoredEntries;
_keyType = src._keyType;
_valueType = src._valueType;
_valueTypeIsStatic = src._valueTypeIsStatic;
_valueTypeSerializer = src._valueTypeSerializer;
_keySerializer = (JsonSerializer<Object>) keySerializer;
_valueSerializer = (JsonSerializer<Object>) valueSerializer;
_dynamicValueSerializers = src._dynamicValueSerializers;
_property = property;
_filterId = src._filterId;
_sortKeys = src._sortKeys;
_suppressableValue = src._suppressableValue;
}
@Deprecated // since 2.5
protected MapSerializer(MapSerializer src, TypeSerializer vts) {
this(src, vts, src._suppressableValue);
}
/**
* @since 2.5
*/
protected MapSerializer(MapSerializer src, TypeSerializer vts,
Object suppressableValue)
{
super(Map.class, false);
_ignoredEntries = src._ignoredEntries;
_keyType = src._keyType;
_valueType = src._valueType;
_valueTypeIsStatic = src._valueTypeIsStatic;
_valueTypeSerializer = vts;
_keySerializer = src._keySerializer;
_valueSerializer = src._valueSerializer;
_dynamicValueSerializers = src._dynamicValueSerializers;
_property = src._property;
_filterId = src._filterId;
_sortKeys = src._sortKeys;
// 05-Jun-2015, tatu: For referential, this is same as NON_EMPTY; for others, NON_NULL, so:
if (suppressableValue ==
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> return, it has to skip the matching
* Json content parser has.
*
* @param p Parser that points to value of the unknown property
* @param ctxt Context for deserialization; allows access to the parser,
* error reporting functionality
* @param instanceOrClass Instance that is being populated by this
* deserializer, or if not known, Class that would be instantiated.
* If null, will assume type is what {@link #getValueClass} returns.
* @param propName Name of the property that can not be mapped
*/
protected void handleUnknownProperty(JsonParser p, DeserializationContext ctxt, Object instanceOrClass, String propName)
throws IOException
{
if (instanceOrClass == null) {
instanceOrClass = handledType();
}
// Maybe we have configured handler(s) to take care of it?
if (ctxt.handleUnknownProperty(p, this, instanceOrClass, propName)) {
return;
}
/* But if we do get this far, need to skip whatever value we
* are pointing to now (although handler is likely to have done that already)
*/
p.skipChildren();
}
protected void handleMissingEndArrayForSingle(JsonParser p, DeserializationContext ctxt)
throws IOException
{
ctxt.reportWrongTokenException(p, JsonToken.END_ARRAY,
"Attempted to unwrap single value array for single '%s' value but there was more than a single value in the array",
handledType().getName());
// 05-May-2016, tatu: Should recover somehow (maybe skip until END_ARRAY);
// but for now just fall through
}
protected void _failDoubleToIntCoercion(JsonParser p, DeserializationContext ctxt,
String type) throws IOException
{
ctxt.reportMappingException("Can not coerce a floating-point value ('%s') into %s; enable `DeserializationFeature.ACCEPT_FLOAT_AS_INT` to allow",
p.getValueAsString(), type);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>JavaType> typeList)
{
JavaType[] types = (typeList == null || typeList.isEmpty()) ?
NO_TYPES : typeList.toArray(new JavaType[typeList.size()]);
return create(erasedType, types);
}
public static TypeBindings create(Class<?> erasedType, JavaType[] types)
{
if (types == null) {
types = NO_TYPES;
} else switch (types.length) {
case 1:
return create(erasedType, types[0]);
case 2:
return create(erasedType, types[0], types[1]);
}
TypeVariable<?>[] vars = erasedType.getTypeParameters();
String[] names;
if (vars == null || vars.length == 0) {
names = NO_STRINGS;
} else {
int len = vars.length;
names = new String[len];
for (int i = 0; i < len; ++i) {
names[i] = vars[i].getName();
}
}
// Check here to give better error message
if (names.length != types.length) {
throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName()
+" with "+types.length+" type parameter"
+((types.length == 1) ? "" : "s")+": class expects "+names.length);
}
return new TypeBindings(names, types, null);
}
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1)
{
// 30-Oct-2015, tatu: Minor optimization for relatively common cases
TypeVariable<?>[] vars = TypeParamStash.paramsFor1(erasedType);
int varLen = (vars == null) ? 0 : vars.length;
if (varLen != 1) {
throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName()
+" with 1 type parameter: class expects "+varLen);
}
return new TypeBindings(new String[] { vars[0].getName() },
new JavaType[] { typeArg1 }, null);
}
public static TypeBindings create(Class<?> erasedType, JavaType typeArg1, JavaType typeArg
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>2)
{
// 30-Oct-2015, tatu: Minor optimization for relatively common cases
TypeVariable<?>[] vars = TypeParamStash.paramsFor2(erasedType);
int varLen = (vars == null) ? 0 : vars.length;
if (varLen != 2) {
throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName()
+" with 2 type parameters: class expects "+varLen);
}
return new TypeBindings(new String[] { vars[0].getName(), vars[1].getName() },
new JavaType[] { typeArg1, typeArg2 }, null);
}
/**
* Alternate factory method that may be called if it is possible that type
* does or does not require type parameters; this is mostly useful for
* collection- and map-like types.
*/
public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType typeArg1)
{
TypeVariable<?>[] vars = erasedType.getTypeParameters();
int varLen = (vars == null) ? 0 : vars.length;
if (varLen == 0) {
return EMPTY;
}
if (varLen != 1) {
throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName()
+" with 1 type parameter: class expects "+varLen);
}
return new TypeBindings(new String[] { vars[0].getName() },
new JavaType[] { typeArg1 }, null);
}
/**
* Alternate factory method that may be called if it is possible that type
* does or does not require type parameters; this is mostly useful for
* collection- and map-like types.
*/
public static TypeBindings createIfNeeded(Class<?> erasedType, JavaType[] types)
{
TypeVariable<?>[] vars = erasedType.getTypeParameters();
if (vars == null || vars.length == 0) {
return EMPTY;
}
if (types == null) {
types = NO_TYPES;
}
int len = vars.length;
String[] names = new String[len];
for (int i = 0; i < len; ++i) {
names[i] = vars[i].getName();
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> // Check here to give better error message
if (names.length != types.length) {
throw new IllegalArgumentException("Can not create TypeBindings for class "+erasedType.getName()
+" with "+types.length+" type parameter"
+((types.length == 1) ? "" : "s")+": class expects "+names.length);
}
return new TypeBindings(names, types, null);
}
/**
* Method for creating an instance that has same bindings as this object,
* plus an indicator for additional type variable that may be unbound within
* this context; this is needed to resolve recursive self-references.
*/
public TypeBindings withUnboundVariable(String name)
{
int len = (_unboundVariables == null) ? 0 : _unboundVariables.length;
String[] names = (len == 0)
? new String[1] : Arrays.copyOf(_unboundVariables, len+1);
names[len] = name;
return new TypeBindings(_names, _types, names);
}
/*
/**********************************************************************
/* Accessors
/**********************************************************************
*/
/**
* Find type bound to specified name, if there is one; returns bound type if so, null if not.
*/
public JavaType findBoundType(String name)
{
for (int i = 0, len = _names.length; i < len; ++i) {
if (name.equals(_names[i])) {
JavaType t = _types[i];
if (t instanceof ResolvedRecursiveType) {
ResolvedRecursiveType rrt = (ResolvedRecursiveType) t;
JavaType t2 = rrt.getSelfReferencedType();
if (t2 != null) {
t = t2;
} else {
/* 25-Feb-2016, tatu: Looks like a potential problem, but alas
* we have a test where this should NOT fail and things... seem
* to work. So be it.
*/
/*
throw new IllegalStateException(String.format
("Unresolved ResolvedRecursiveType for parameter '%s' (index #%d; erased type %s)",
name, i, t.getRawClass()));
*/
}
}
return t;
}
}
return null;
}
public
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> false;
}
}
return true;
}
}
return false;
}
@Override
public String toString() {
return _raw.getName()+"<>";
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> StringBuilder sb = new StringBuilder();
sb.append(_class.getName());
if (_keyType != null) {
sb.append('<');
sb.append(_keyType.toCanonical());
sb.append(',');
sb.append(_valueType.toCanonical());
sb.append('>');
}
return sb.toString();
}
/*
/**********************************************************
/* Public API
/**********************************************************
*/
@Override
public boolean isContainerType() {
return true;
}
@Override
public boolean isMapLikeType() {
return true;
}
@Override
public JavaType getKeyType() {
return _keyType;
}
@Override
public JavaType getContentType() {
return _valueType;
}
@Override
public Object getContentValueHandler() {
return _valueType.getValueHandler();
}
@Override
public Object getContentTypeHandler() {
return _valueType.getTypeHandler();
}
@Override
public boolean hasHandlers() {
return super.hasHandlers() || _valueType.hasHandlers()
|| _keyType.hasHandlers();
}
@Override
public StringBuilder getErasedSignature(StringBuilder sb) {
return _classSignature(_class, sb, true);
}
@Override
public StringBuilder getGenericSignature(StringBuilder sb) {
_classSignature(_class, sb, false);
sb.append('<');
_keyType.getGenericSignature(sb);
_valueType.getGenericSignature(sb);
sb.append(">;");
return sb;
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
public MapLikeType withKeyTypeHandler(Object h) {
return new MapLikeType(_class, _bindings, _superClass,
_superInterfaces, _keyType.withTypeHandler(h), _valueType,
_valueHandler, _typeHandler, _asStatic);
}
public MapLikeType withKeyValueHandler(Object h) {
return new MapLikeType(_class, _bindings, _superClass,
_superInterfaces, _keyType.withValueHandler(h), _valueType,
_valueHandler, _typeHandler, _asStatic);
}
/**
* Method that can be used for checking whether this type is a "real"
* Collection type; meaning whether it represents a parameterized subtype of
* {@link java.
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>util.Collection} or just something that acts like one.
*/
public boolean isTrueMapType() {
return Map.class.isAssignableFrom(_class);
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override
public String toString() {
return String.format("[map-like type; class %s, %s -> %s]",
_class.getName(), _keyType, _valueType);
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;
MapLikeType other = (MapLikeType) o;
return (_class == other._class) && _keyType.equals(other._keyType)
&& _valueType.equals(other._valueType);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> fieldName, List<String> foundSoFar);
public abstract List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar);
/*
/**********************************************************
/* Public API, path handling
/**********************************************************
*/
/**
* Method that can be called on Object nodes, to access a property
* that has Object value; or if no such property exists, to create,
* add and return such Object node.
* If the node method is called on is not Object node,
* or if property exists and has value that is not Object node,
* {@link UnsupportedOperationException} is thrown
*/
public JsonNode with(String propertyName) {
throw new UnsupportedOperationException("JsonNode not of type ObjectNode (but "
+getClass().getName()+"), can not call with() on it");
}
/**
* Method that can be called on Object nodes, to access a property
* that has <code>Array</code> value; or if no such property exists, to create,
* add and return such Array node.
* If the node method is called on is not Object node,
* or if property exists and has value that is not Array node,
* {@link UnsupportedOperationException} is thrown
*/
public JsonNode withArray(String propertyName) {
throw new UnsupportedOperationException("JsonNode not of type ObjectNode (but "
+getClass().getName()+"), can not call withArray() on it");
}
/*
/**********************************************************
/* Public API, comparison
/**********************************************************
*/
/**
* Entry method for invoking customizable comparison, using passed-in
* {@link Comparator} object. Nodes will handle traversal of structured
* types (arrays, objects), but defer to comparator for scalar value
* comparisons. If a "natural" {@link Comparator} is passed -- one that
* simply calls <code>equals()</code> on one of arguments, passing the other
* -- implementation is the same as directly calling <code>equals()</code>
* on node.
*<p>
* Default implementation simply delegates to passed in <code>comparator</code>,
* with <code>this</code> as the first argument, and <code>other</code> as
* the second argument.
*
* @param comparator Object called to compare two scalar {@link JsonNode}
* instances, and return either 0 (are equals) or non
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> for "+handledType().getName();
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.exc;
import java.util.*;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonMappingException;
/**
* Specialized {@link JsonMappingException} sub-class used to indicate
* case where an explicitly ignored property is encountered, and mapper
* is configured to consider this an error.
*
* @since 2.3
*/
public class IgnoredPropertyException
extends PropertyBindingException
{
private static final long serialVersionUID = 1L;
/**
* @since 2.7
*/
public IgnoredPropertyException(JsonParser p, String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
{
super(p, msg, loc, referringClass, propName, propertyIds);
}
/**
* @deprecated Since 2.7
*/
@Deprecated
public IgnoredPropertyException(String msg, JsonLocation loc,
Class<?> referringClass, String propName,
Collection<Object> propertyIds)
{
super(msg, loc, referringClass, propName, propertyIds);
}
/**
* Factory method used for constructing instances of this exception type.
*
* @param p Underlying parser used for reading input being used for data-binding
* @param fromObjectOrClass Reference to either instance of problematic type (
* if available), or if not, type itself
* @param propertyName Name of unrecognized property
* @param propertyIds (optional, null if not available) Set of properties that
* type would recognize, if completely known: null if set can not be determined.
*/
public static IgnoredPropertyException from(JsonParser p,
Object fromObjectOrClass, String propertyName,
Collection<Object> propertyIds)
{
if (fromObjectOrClass == null) {
throw new IllegalArgumentException();
}
Class<?> ref;
if (fromObjectOrClass instanceof Class<?>) {
ref = (Class<?>) fromObjectOrClass;
} else {
ref = fromObjectOrClass.getClass();
}
String msg = "Ignored field \""+propertyName+"\" (class "+ref.getName()
+") encountered; mapper configured not to
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
_filteredProps = filteredProperties;
_typeId = src._typeId;
_anyGetterWriter = src._anyGetterWriter;
_objectIdWriter = src._objectIdWriter;
_propertyFilterId = src._propertyFilterId;
_serializationShape = src._serializationShape;
}
protected BeanSerializerBase(BeanSerializerBase src,
ObjectIdWriter objectIdWriter)
{
this(src, objectIdWriter, src._propertyFilterId);
}
/**
* @since 2.3
*/
protected BeanSerializerBase(BeanSerializerBase src,
ObjectIdWriter objectIdWriter, Object filterId)
{
super(src._handledType);
_props = src._props;
_filteredProps = src._filteredProps;
_typeId = src._typeId;
_anyGetterWriter = src._anyGetterWriter;
_objectIdWriter = objectIdWriter;
_propertyFilterId = filterId;
_serializationShape = src._serializationShape;
}
@Deprecated // since 2.8, remove soon
protected BeanSerializerBase(BeanSerializerBase src, String[] toIgnore)
{
this(src, ArrayBuilders.arrayToSet(toIgnore));
}
protected BeanSerializerBase(BeanSerializerBase src, Set<String> toIgnore)
{
super(src._handledType);
final BeanPropertyWriter[] propsIn = src._props;
final BeanPropertyWriter[] fpropsIn = src._filteredProps;
final int len = propsIn.length;
ArrayList<BeanPropertyWriter> propsOut = new ArrayList<BeanPropertyWriter>(len);
ArrayList<BeanPropertyWriter> fpropsOut = (fpropsIn == null) ? null : new ArrayList<BeanPropertyWriter>(len);
for (int i = 0; i < len; ++i) {
BeanPropertyWriter bpw = propsIn[i];
// should be ignored?
if ((toIgnore != null) && toIgnore.contains(bpw.getName())) {
continue;
}
propsOut.add(bpw);
if (fpropsIn != null) {
fpropsOut.add(fpropsIn[i]);
}
}
_props = propsOut.toArray(new BeanPropertyWriter[propsOut.size()]);
_filteredProps = (fpropsOut == null) ? null : fprops
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>, property);
}
}
}
}
ObjectIdWriter oiw = _objectIdWriter;
Set<String> ignoredProps = null;
Object newFilterId = null;
// Then we may have an override for Object Id
if (accessor != null) {
JsonIgnoreProperties.Value ignorals = intr.findPropertyIgnorals(accessor);
if (ignorals != null) {
ignoredProps = ignorals.findIgnoredForSerialization();
}
ObjectIdInfo objectIdInfo = intr.findObjectIdInfo(accessor);
if (objectIdInfo == null) {
// no ObjectId override, but maybe ObjectIdRef?
if (oiw != null) {
objectIdInfo = intr.findObjectReferenceInfo(accessor,
new ObjectIdInfo(NAME_FOR_OBJECT_REF, null, null, null));
oiw = _objectIdWriter.withAlwaysAsId(objectIdInfo.getAlwaysAsId());
}
} else {
/* Ugh: mostly copied from BeanSerializerBase: but can't easily
* change it to be able to move to SerializerProvider (where it
* really belongs)
*/
// 2.1: allow modifications by "id ref" annotations as well:
objectIdInfo = intr.findObjectReferenceInfo(accessor, objectIdInfo);
ObjectIdGenerator<?> gen;
Class<?> implClass = objectIdInfo.getGeneratorType();
JavaType type = provider.constructType(implClass);
JavaType idType = provider.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0];
// Property-based generator is trickier
if (implClass == ObjectIdGenerators.PropertyGenerator.class) { // most special one, needs extra work
String propName = objectIdInfo.getPropertyName().getSimpleName();
BeanPropertyWriter idProp = null;
for (int i = 0, len = _props.length ;; ++i) {
if (i == len) {
throw new IllegalArgumentException("Invalid Object Id definition for "+_handledType.getName()
+": can not find property with name '"+propName+"'");
}
BeanPropertyWriter prop = _props[i];
if (propName.equals(prop.getName())) {
idProp = prop;
/* Let's force it to be the first property to output
* (although it may still get rearrange
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
return (typeId instanceof String) ? (String) typeId : typeId.toString();
}
/*
/**********************************************************
/* Field serialization methods
/**********************************************************
*/
protected void serializeFields(Object bean, JsonGenerator gen, SerializerProvider provider)
throws IOException
{
final BeanPropertyWriter[] props;
if (_filteredProps != null && provider.getActiveView() != null) {
props = _filteredProps;
} else {
props = _props;
}
int i = 0;
try {
for (final int len = props.length; i < len; ++i) {
BeanPropertyWriter prop = props[i];
if (prop != null) { // can have nulls in filtered list
prop.serializeAsField(bean, gen, provider);
}
}
if (_anyGetterWriter != null) {
_anyGetterWriter.getAndSerialize(bean, gen, provider);
}
} catch (Exception e) {
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
wrapAndThrow(provider, e, bean, name);
} catch (StackOverflowError e) {
/* 04-Sep-2009, tatu: Dealing with this is tricky, since we do not
* have many stack frames to spare... just one or two; can't
* make many calls.
*/
// 10-Dec-2015, tatu: and due to above, avoid "from" method, call ctor directly:
//JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e);
JsonMappingException mapE = new JsonMappingException(gen, "Infinite recursion (StackOverflowError)", e);
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
mapE.prependPath(new JsonMappingException.Reference(bean, name));
throw mapE;
}
}
/**
* Alternative serialization method that gets called when there is a
* {@link PropertyFilter} that needs to be called to determine
* which properties are to be serialized (and possibly how)
*/
protected void serializeFieldsFiltered(Object bean, JsonGenerator gen,
SerializerProvider provider)
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
throws IOException, JsonGenerationException
{
/* note: almost verbatim copy of "serializeFields"; copied (instead of merged)
* so that old method need not add check for existence of filter.
*/
final BeanPropertyWriter[] props;
if (_filteredProps != null && provider.getActiveView() != null) {
props = _filteredProps;
} else {
props = _props;
}
final PropertyFilter filter = findPropertyFilter(provider, _propertyFilterId, bean);
// better also allow missing filter actually..
if (filter == null) {
serializeFields(bean, gen, provider);
return;
}
int i = 0;
try {
for (final int len = props.length; i < len; ++i) {
BeanPropertyWriter prop = props[i];
if (prop != null) { // can have nulls in filtered list
filter.serializeAsField(bean, gen, provider, prop);
}
}
if (_anyGetterWriter != null) {
_anyGetterWriter.getAndFilter(bean, gen, provider, filter);
}
} catch (Exception e) {
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
wrapAndThrow(provider, e, bean, name);
} catch (StackOverflowError e) {
// Minimize call depth since we are close to fail:
//JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e);
JsonMappingException mapE = new JsonMappingException(gen, "Infinite recursion (StackOverflowError)", e);
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
mapE.prependPath(new JsonMappingException.Reference(bean, name));
throw mapE;
}
}
@Deprecated
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
throws JsonMappingException
{
ObjectNode o = createSchemaNode("object", true);
// [JACKSON-813]: Add optional JSON Schema id attribute, if found
// NOTE: not optimal, does NOT go through AnnotationIntrospector etc:
JsonSerializableSchema ann = _handledType.getAnnotation(JsonSerializableSchema.class);
if (
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind;
import java.lang.annotation.Annotation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor;
import com.fasterxml.jackson.databind.util.Annotations;
import com.fasterxml.jackson.databind.util.Named;
/**
* Bean properties are logical entities that represent data
* that Java objects (POJOs (Plain Old Java Objects), sometimes also called "beans")
* contain; and that are accessed using accessors (methods like getters
* and setters, fields, constructor parametrers).
* Instances allow access to annotations directly associated
* to property (via field or method), as well as contextual
* annotations (annotations for class that contains properties).
*<p>
* Instances are not typically passed when constructing serializers
* and deserializers, but rather only passed when context
* is known when
* {@link com.fasterxml.jackson.databind.ser.ContextualSerializer} and
* {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer}
* resolution occurs (<code>createContextual(...)</code> method is called).
* References may (need to) be retained by serializers and deserializers,
* especially when further resolving dependant handlers like value
* serializers/deserializers or structured types.
*/
public interface BeanProperty extends Named
{
public final static JsonFormat.Value EMPTY_FORMAT = new JsonFormat.Value();
public final static JsonInclude.Value EMPTY_INCLUDE = JsonInclude.Value.empty();
/**
* Method to get logical name of the property
*/
@Override
public String getName();
/**
* Method for getting full name definition, including possible
* format-specific additional properties (such as namespace when
* using XML backend).
*
* @since 2.3
*/
public PropertyName getFullName();
/**
* Method to get declared type of the property.
*/
public JavaType getType();
/**
* If property is indicated to be wrapped, name of
* wrapper element to use.
*
* @
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if ((intr == null) || (_member == null)) {
return v0;
}
JsonInclude.Value v = intr.findPropertyInclusion(_member);
if (v == null) {
return v0;
}
return v0.withOverrides(v);
}
@Override public String getName() { return _name.getSimpleName(); }
@Override public PropertyName getFullName() { return _name; }
@Override public JavaType getType() { return _type; }
@Override public PropertyName getWrapperName() { return _wrapperName; }
@Override public boolean isRequired() { return _metadata.isRequired(); }
@Override public PropertyMetadata getMetadata() { return _metadata; }
@Override public AnnotatedMember getMember() { return _member; }
@Override
public boolean isVirtual() { return false; }
/**
* Implementation of this method throws
* {@link UnsupportedOperationException}, since instances of this
* implementation should not be used as part of actual structure
* visited. Rather, other implementations should handle it.
*/
@Override
public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor,
SerializerProvider provider) {
throw new UnsupportedOperationException("Instances of "+getClass().getName()+" should not get visited");
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
/**********************************************************
/* Life-cycle
/**********************************************************
*/
/**
* @param raw "Raw" (type-erased) class for this type
* @param additionalHash Additional hash code to use, in addition
* to hash code of the class name
*/
protected JavaType(Class<?> raw, int additionalHash,
Object valueHandler, Object typeHandler, boolean asStatic)
{
_class = raw;
_hash = raw.getName().hashCode() + additionalHash;
_valueHandler = valueHandler;
_typeHandler = typeHandler;
_asStatic = asStatic;
}
/**
* Copy-constructor used when refining/upgrading type instances.
*
* @since 2.7
*/
protected JavaType(JavaType base)
{
_class = base._class;
_hash = base._hash;
_valueHandler = base._valueHandler;
_typeHandler = base._typeHandler;
_asStatic = base._asStatic;
}
/**
* "Copy method" that will construct a new instance that is identical to
* this instance, except that it will have specified type handler assigned.
*
* @return Newly created type instance
*/
public abstract JavaType withTypeHandler(Object h);
/**
* Mutant factory method that will construct a new instance that is identical to
* this instance, except that it will have specified content type (element type
* for arrays, value type for Maps and so forth) handler assigned.
*
* @return Newly created type instance, with given
*/
public abstract JavaType withContentTypeHandler(Object h);
/**
* Mutant factory method that will construct a new instance that is identical to
* this instance, except that it will have specified value handler assigned.
*
* @return Newly created type instance
*/
public abstract JavaType withValueHandler(Object h);
/**
* Mutant factory method that will construct a new instance that is identical to
* this instance, except that it will have specified content value handler assigned.
*
* @return Newly created type instance
*/
public abstract JavaType withContentValueHandler(Object h);
/**
* Mutant factory method that will try to copy handlers that the specified
* source type instance had, if any; this must be done recursively
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> can be called to locate value to be injected for this
* property, if it is configured for this.
*/
public Object findInjectableValue(DeserializationContext context, Object beanInstance)
{
if (_injectableValueId == null) {
throw new IllegalStateException("Property '"+getName()
+"' (type "+getClass().getName()+") has no injectable value id configured");
}
return context.findInjectableValue(_injectableValueId, this, beanInstance);
}
/**
* Method to find value to inject, and inject it to this property.
*/
public void inject(DeserializationContext context, Object beanInstance)
throws IOException
{
set(beanInstance, findInjectableValue(context, beanInstance));
}
/*
/**********************************************************
/* BeanProperty impl
/**********************************************************
*/
@Override
public <A extends Annotation> A getAnnotation(Class<A> acls) {
if (_annotated == null) {
return null;
}
return _annotated.getAnnotation(acls);
}
@Override public AnnotatedMember getMember() { return _annotated; }
@Override public int getCreatorIndex() {
return _creatorIndex;
}
/*
/**********************************************************
/* Overridden methods
/**********************************************************
*/
@Override
public void deserializeAndSet(JsonParser p, DeserializationContext ctxt,
Object instance) throws IOException
{
set(instance, deserialize(p, ctxt));
}
@Override
public Object deserializeSetAndReturn(JsonParser p,
DeserializationContext ctxt, Object instance) throws IOException
{
return setAndReturn(instance, deserialize(p, ctxt));
}
@Override
public void set(Object instance, Object value) throws IOException
{
/* Hmmmh. Should we return quietly (NOP), or error?
* Perhaps better to throw an exception, since it's generally an error.
*/
if (_fallbackSetter == null) {
throw new IllegalStateException("No fallback setter/field defined: can not use creator property for "
+getClass().getName());
}
_fallbackSetter.set(instance, value);
}
@Override
public Object setAndReturn(Object instance, Object value) throws IOException
{
if (_fallbackSetter == null) {
throw new IllegalStateException("No fallback setter/field defined: can not use creator property for "
+
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>getClass().getName());
}
return _fallbackSetter.setAndReturn(instance, value);
}
@Override
public Object getInjectableValueId() {
return _injectableValueId;
}
@Override
public String toString() { return "[creator property, name '"+getName()+"'; inject id '"+_injectableValueId+"']"; }
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
final MapperConfig<?> config = getConfig();
HandlerInstantiator hi = config.getHandlerInstantiator();
ObjectIdGenerator<?> gen = (hi == null) ? null : hi.objectIdGeneratorInstance(config, annotated, implClass);
if (gen == null) {
gen = (ObjectIdGenerator<?>) ClassUtil.createInstance(implClass,
config.canOverrideAccessModifiers());
}
return gen.forScope(objectIdInfo.getScope());
}
public ObjectIdResolver objectIdResolverInstance(Annotated annotated, ObjectIdInfo objectIdInfo)
{
Class<? extends ObjectIdResolver> implClass = objectIdInfo.getResolverType();
final MapperConfig<?> config = getConfig();
HandlerInstantiator hi = config.getHandlerInstantiator();
ObjectIdResolver resolver = (hi == null) ? null : hi.resolverIdGeneratorInstance(config, annotated, implClass);
if (resolver == null) {
resolver = ClassUtil.createInstance(implClass, config.canOverrideAccessModifiers());
}
return resolver;
}
/**
* Helper method to use to construct a {@link Converter}, given a definition
* that may be either actual converter instance, or Class for instantiating one.
*
* @since 2.2
*/
@SuppressWarnings("unchecked")
public Converter<Object,Object> converterInstance(Annotated annotated,
Object converterDef)
throws JsonMappingException
{
if (converterDef == null) {
return null;
}
if (converterDef instanceof Converter<?,?>) {
return (Converter<Object,Object>) converterDef;
}
if (!(converterDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned Converter definition of type "
+converterDef.getClass().getName()+"; expected type Converter or Class<Converter> instead");
}
Class<?> converterClass = (Class<?>)converterDef;
// there are some known "no class" markers to consider too:
if (converterClass == Converter.None.class || ClassUtil.isBogusClass(converterClass)) {
return null;
}
if (!Converter.class.isAssignableFrom(converterClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "
+converterClass.getName()+"; expected Class<Converter>");
}
final MapperConfig<?> config = getConfig();
HandlerInstantiator hi = config.getHandlerInstantiator();
Converter
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.ser.std;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
/**
* Container class for serializers used for handling standard JDK-provided
* types.
*/
@SuppressWarnings("serial")
public class NumberSerializers {
protected NumberSerializers() { }
public static void addAll(Map<String, JsonSerializer<?>> allDeserializers) {
allDeserializers.put(Integer.class.getName(), new IntegerSerializer(Integer.class));
allDeserializers.put(Integer.TYPE.getName(), new IntegerSerializer(Integer.TYPE));
allDeserializers.put(Long.class.getName(), new LongSerializer(Long.class));
allDeserializers.put(Long.TYPE.getName(), new LongSerializer(Long.TYPE));
allDeserializers.put(Byte.class.getName(), IntLikeSerializer.instance);
allDeserializers.put(Byte.TYPE.getName(), IntLikeSerializer.instance);
allDeserializers.put(Short.class.getName(), ShortSerializer.instance);
allDeserializers.put(Short.TYPE.getName(), ShortSerializer.instance);
// Numbers, limited length floating point
allDeserializers.put(Double.class.getName(), new DoubleSerializer(Double.class));
allDeserializers.put(Double.TYPE.getName(), new DoubleSerializer(Double.TYPE));
allDeserializers.put(Float.class.getName(), FloatSerializer.instance);
allDeserializers.put(Float.TYPE.getName(), FloatSerializer.instance);
}
/*
/**********************************************************
/* Shared base class
/**********************************************************
*/
protected abstract static class Base<T> extends StdScalarSerializer<T>
implements ContextualSerializer {
protected final JsonParser.NumberType _numberType;
protected final String _schemaType;
protected
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.ser.impl;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.databind.introspect.ObjectIdInfo;
import com.fasterxml.jackson.databind.ser.*;
public class PropertyBasedObjectIdGenerator
extends ObjectIdGenerators.PropertyGenerator
{
private static final long serialVersionUID = 1L;
protected final BeanPropertyWriter _property;
public PropertyBasedObjectIdGenerator(ObjectIdInfo oid, BeanPropertyWriter prop)
{
this(oid.getScope(), prop);
}
protected PropertyBasedObjectIdGenerator(Class<?> scope, BeanPropertyWriter prop)
{
super(scope);
_property = prop;
}
/**
* We must override this method, to prevent errors when scopes are the same,
* but underlying class (on which to access property) is different.
*/
@Override
public boolean canUseFor(ObjectIdGenerator<?> gen) {
if (gen.getClass() == getClass()) {
PropertyBasedObjectIdGenerator other = (PropertyBasedObjectIdGenerator) gen;
if (other.getScope() == _scope) {
/* 26-Jul-2012, tatu: This is actually not enough, because the property
* accessor within BeanPropertyWriter won't work for other property fields
* (see [https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/9]
* for details).
* So we need to verify that underlying property is actually the same.
*/
return (other._property == _property);
}
}
return false;
}
@Override
public Object generateId(Object forPojo) {
try {
return _property.get(forPojo);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Problem accessing property '"
+_property.getName()+"': "+e.getMessage(), e);
}
}
@Override
public ObjectIdGenerator<Object> forScope(Class<?> scope) {
return (scope == _scope) ? this : new PropertyBasedObjectIdGenerator(scope, _property);
}
@Override
public ObjectIdGenerator<Object> newForSerialization(Object context) {
// No state
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.ext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;
/**
* To support Java7-incomplete platforms, we will offer support for JDK 7
* annotations through this class, loaded dynamically; if loading fails,
* support will be missing. This class is the non-JDK-7-dependent API,
* and {@link Java7SupportImpl} is JDK7-dependent implementation of
* functionality.
*/
public abstract class Java7Support
{
private final static Java7Support IMPL;
static {
Java7Support impl = null;
try {
Class<?> cls = Class.forName("com.fasterxml.jackson.databind.ext.Java7SupportImpl");
impl = (Java7Support) cls.newInstance();
} catch (Throwable t) {
// 24-Nov-2015, tatu: Should we log or not?
java.util.logging.Logger.getLogger(Java7Support.class.getName())
.warning("Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added");
}
IMPL = impl;
}
public static Java7Support instance() {
return IMPL;
}
public abstract Boolean findTransient(Annotated a);
public abstract Boolean hasCreatorAnnotation(Annotated a);
public abstract PropertyName findConstructorName(AnnotatedParameter p);
public abstract Class<?> getClassJavaNioFilePath();
public abstract JsonDeserializer<?> getDeserializerForJavaNioFilePath(Class<?> rawType);
public abstract JsonSerializer<?> getSerializerForJavaNioFilePath(Class<?> rawType);
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Overrides;
_serializationConfig = new SerializationConfig(base,
_subtypeResolver, mixins, rootNames, propOverrides);
_deserializationConfig = new DeserializationConfig(base,
_subtypeResolver, mixins, rootNames, propOverrides);
// Some overrides we may need
final boolean needOrder = _jsonFactory.requiresPropertyOrdering();
if (needOrder ^ _serializationConfig.isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)) {
configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, needOrder);
}
_serializerProvider = (sp == null) ? new DefaultSerializerProvider.Impl() : sp;
_deserializationContext = (dc == null) ?
new DefaultDeserializationContext.Impl(BeanDeserializerFactory.instance) : dc;
// Default serializer factory is stateless, can just assign
_serializerFactory = BeanSerializerFactory.instance;
}
/**
* Overridable helper method used to construct default {@link ClassIntrospector}
* to use.
*
* @since 2.5
*/
protected ClassIntrospector defaultClassIntrospector() {
return new BasicClassIntrospector();
}
/*
/**********************************************************
/* Methods sub-classes MUST override
/**********************************************************
*/
/**
* Method for creating a new {@link ObjectMapper} instance that
* has same initial configuration as this instance. Note that this
* also requires making a copy of the underlying {@link JsonFactory}
* instance.
*<p>
* Method is typically
* used when multiple, differently configured mappers are needed.
* Although configuration is shared, cached serializers and deserializers
* are NOT shared, which means that the new instance may be re-configured
* before use; meaning that it behaves the same way as if an instance
* was constructed from scratch.
*
* @since 2.1
*/
public ObjectMapper copy() {
_checkInvalidCopy(ObjectMapper.class);
return new ObjectMapper(this);
}
/**
* @since 2.1
*/
protected void _checkInvalidCopy(Class<?> exp)
{
if (getClass() != exp) {
throw new IllegalStateException("Failed copy(): "+getClass().getName()
+" (version: "+version()+") does not override copy(); it has to");
}
}
/*
/
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (deser != null) {
return deser;
}
// Nope: need to ask provider to resolve it
deser = ctxt.findRootValueDeserializer(valueType);
if (deser == null) { // can this happen?
throw JsonMappingException.from(ctxt,
"Can not find a deserializer for type "+valueType);
}
_rootDeserializers.put(valueType, deser);
return deser;
}
/**
* @since 2.2
*/
protected void _verifySchemaType(FormatSchema schema)
{
if (schema != null) {
if (!_jsonFactory.canUseSchema(schema)) {
throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName()
+" for format "+_jsonFactory.getFormatName());
}
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>7-Sep-2015, tatu: should not really happen. But... can we do anything?
}
return value.name();
}
@Override // since 2.7
public String[] findEnumValues(Class<?> enumType, Enum<?>[] enumValues, String[] names) {
HashMap<String,String> expl = null;
for (Field f : ClassUtil.getDeclaredFields(enumType)) {
if (!f.isEnumConstant()) {
continue;
}
JsonProperty prop = f.getAnnotation(JsonProperty.class);
if (prop == null) {
continue;
}
String n = prop.value();
if (n.isEmpty()) {
continue;
}
if (expl == null) {
expl = new HashMap<String,String>();
}
expl.put(f.getName(), n);
}
// and then stitch them together if and as necessary
if (expl != null) {
for (int i = 0, end = enumValues.length; i < end; ++i) {
String defName = enumValues[i].name();
String explValue = expl.get(defName);
if (explValue != null) {
names[i] = explValue;
}
}
}
return names;
}
/**
* Finds the Enum value that should be considered the default value, if possible.
* <p>
* This implementation relies on {@link JsonEnumDefaultValue} annotation to determine the default value if present.
*
* @param enumCls The Enum class to scan for the default value.
* @return null if none found or it's not possible to determine one.
* @since 2.8
*/
@Override
public Enum<?> findDefaultEnumValue(Class<Enum<?>> enumCls) {
return ClassUtil.findFirstAnnotatedEnumValue(enumCls, JsonEnumDefaultValue.class);
}
/*
/**********************************************************
/* General class annotations
/**********************************************************
*/
@Override
public PropertyName findRootName(AnnotatedClass ac)
{
JsonRootName ann = _findAnnotation(ac, JsonRootName.class);
if (ann == null) {
return null;
}
String ns = ann.namespace();
if (ns != null && ns.length() == 0) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>;
}
String str = prop.defaultValue();
// Since annotations do not allow nulls, need to assume empty means "none"
return str.isEmpty() ? null : str;
}
@Override
public JsonFormat.Value findFormat(Annotated ann) {
JsonFormat f = _findAnnotation(ann, JsonFormat.class);
return (f == null) ? null : new JsonFormat.Value(f);
}
@Override
public ReferenceProperty findReferenceType(AnnotatedMember member)
{
JsonManagedReference ref1 = _findAnnotation(member, JsonManagedReference.class);
if (ref1 != null) {
return AnnotationIntrospector.ReferenceProperty.managed(ref1.value());
}
JsonBackReference ref2 = _findAnnotation(member, JsonBackReference.class);
if (ref2 != null) {
return AnnotationIntrospector.ReferenceProperty.back(ref2.value());
}
return null;
}
@Override
public NameTransformer findUnwrappingNameTransformer(AnnotatedMember member)
{
JsonUnwrapped ann = _findAnnotation(member, JsonUnwrapped.class);
// if not enabled, just means annotation is not enabled; not necessarily
// that unwrapping should not be done (relevant when using chained introspectors)
if (ann == null || !ann.enabled()) {
return null;
}
String prefix = ann.prefix();
String suffix = ann.suffix();
return NameTransformer.simpleTransformer(prefix, suffix);
}
@Override
public Object findInjectableValueId(AnnotatedMember m)
{
JacksonInject ann = _findAnnotation(m, JacksonInject.class);
if (ann == null) {
return null;
}
/* Empty String means that we should use name of declared
* value class.
*/
String id = ann.value();
if (id.length() == 0) {
// slight complication; for setters, type
if (!(m instanceof AnnotatedMethod)) {
return m.getRawType().getName();
}
AnnotatedMethod am = (AnnotatedMethod) m;
if (am.getParameterCount() == 0) {
return m.getRawType().getName();
}
return am.getRawParameterType(0).getName();
}
return id;
}
@Override
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
/**********************************************************
*/
/**
* Convenience method that may be used by composite or container deserializers,
* for reading one-off values contained (for sequences, it is more efficient
* to actually fetch deserializer once for the whole collection).
*<p>
* NOTE: when deserializing values of properties contained in composite types,
* rather use {@link #readPropertyValue(JsonParser, BeanProperty, Class)};
* this method does not allow use of contextual annotations.
*
* @since 2.4
*/
public <T> T readValue(JsonParser p, Class<T> type) throws IOException {
return readValue(p, getTypeFactory().constructType(type));
}
/**
* @since 2.4
*/
@SuppressWarnings("unchecked")
public <T> T readValue(JsonParser p, JavaType type) throws IOException {
JsonDeserializer<Object> deser = findRootValueDeserializer(type);
if (deser == null) {
reportMappingException("Could not find JsonDeserializer for type %s", type);
}
return (T) deser.deserialize(p, this);
}
/**
* Convenience method that may be used by composite or container deserializers,
* for reading one-off values for the composite type, taking into account
* annotations that the property (passed to this method -- usually property that
* has custom serializer that called this method) has.
*
* @since 2.4
*/
public <T> T readPropertyValue(JsonParser p, BeanProperty prop, Class<T> type) throws IOException {
return readPropertyValue(p, prop, getTypeFactory().constructType(type));
}
/**
* @since 2.4
*/
@SuppressWarnings("unchecked")
public <T> T readPropertyValue(JsonParser p, BeanProperty prop, JavaType type) throws IOException {
JsonDeserializer<Object> deser = findContextualValueDeserializer(type, prop);
if (deser == null) {
String propName = (prop == null) ? "NULL" : ("'"+prop.getName()+"'");
reportMappingException(
"Could not find JsonDeserializer for type %s (via property %s)",
type, propName);
}
return (T) deser.deserialize(p, this);
}
/*
/
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>(msg, msgArgs);
}
throw JsonMappingException.from(getParser(), msg);
}
/**
* @since 2.8
*/
public void reportMissingContent(String msg, Object... msgArgs)
throws JsonMappingException
{
if (msg == null) {
msg = "No content to map due to end-of-input";
} else if (msgArgs.length > 0) {
msg = String.format(msg, msgArgs);
}
throw JsonMappingException.from(getParser(), msg);
}
/**
* @since 2.8
*/
public void reportUnresolvedObjectId(ObjectIdReader oidReader, Object bean)
throws JsonMappingException
{
String msg = String.format("No Object Id found for an instance of %s, to assign to property '%s'",
bean.getClass().getName(), oidReader.propertyName);
throw JsonMappingException.from(getParser(), msg);
}
/**
* Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific Java type, unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/
public <T> T reportBadTypeDefinition(BeanDescription bean,
String message, Object... args) throws JsonMappingException {
if (args != null && args.length > 0) {
message = String.format(message, args);
}
String beanDesc = (bean == null) ? "N/A" : _desc(bean.getType().getGenericSignature());
throw mappingException("Invalid type definition for type %s: %s",
beanDesc, message);
}
/**
* Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific property (of a type), unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/
public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop,
String message, Object... args) throws JsonMappingException {
if (args != null && args.length > 0) {
message = String.format(message, args);
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> String propName = (prop == null) ? "N/A" : _quotedString(prop.getName());
String beanDesc = (bean == null) ? "N/A" : _desc(bean.getType().getGenericSignature());
throw mappingException("Invalid definition for property %s (of type %s): %s",
propName, beanDesc, message);
}
/*
/**********************************************************
/* Methods for constructing exceptions, "untyped"
/**********************************************************
*/
/**
* Helper method for constructing generic mapping exception with specified
* message and current location information.
* Note that application code should almost always call
* one of <code>handleXxx</code> methods, or {@link #reportMappingException(String, Object...)}
* instead.
*
* @since 2.6
*/
public JsonMappingException mappingException(String message) {
return JsonMappingException.from(getParser(), message);
}
/**
* Helper method for constructing generic mapping exception with specified
* message and current location information
* Note that application code should almost always call
* one of <code>handleXxx</code> methods, or {@link #reportMappingException(String, Object...)}
* instead.
*
* @since 2.6
*/
public JsonMappingException mappingException(String msgTemplate, Object... args) {
if (args != null && args.length > 0) {
msgTemplate = String.format(msgTemplate, args);
}
return JsonMappingException.from(getParser(), msgTemplate);
}
/**
* Helper method for constructing generic mapping exception for specified type
*
* @deprecated Since 2.8 use {@link #handleUnexpectedToken(Class, JsonParser)} instead
*/
@Deprecated
public JsonMappingException mappingException(Class<?> targetClass) {
return mappingException(targetClass, _parser.getCurrentToken());
}
/**
* @deprecated Since 2.8 use {@link #handleUnexpectedToken(Class, JsonParser)} instead
*/
@Deprecated
public JsonMappingException mappingException(Class<?> targetClass, JsonToken token) {
String tokenDesc = (token == null) ? "<end of input>" : String.format("%s token", token);
return JsonMappingException.from(_parser,
String.format("
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Can not deserialize instance of %s out of %s",
_calcName(targetClass), tokenDesc));
}
/*
/**********************************************************
/* Methods for constructing semantic exceptions; usually not
/* to be called directly, call `handleXxx()` instead
/**********************************************************
*/
/**
* Helper method for constructing {@link JsonMappingException} to indicate
* that the token encountered was of type different than what <b>should</b>
* be seen at that position, usually within a sequence of expected tokens.
* Note that most of the time this method should NOT be directly called;
* instead, {@link #reportWrongTokenException} should be called and will
* call this method as necessary.
*/
public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken,
String msg0)
{
String msg = String.format("Unexpected token (%s), expected %s",
p.getCurrentToken(), expToken);
if (msg0 != null) {
msg = msg + ": "+msg0;
}
return JsonMappingException.from(p, msg);
}
/**
* Helper method for constructing exception to indicate that given JSON
* Object field name was not in format to be able to deserialize specified
* key type.
* Note that most of the time this method should NOT be called; instead,
* {@link #handleWeirdKey} should be called which will call this method
* if necessary.
*/
public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue,
String msg) {
return InvalidFormatException.from(_parser,
String.format("Can not deserialize Map key of type %s from String %s: %s",
keyClass.getName(), _quotedString(keyValue), msg),
keyValue, keyClass);
}
/**
* Helper method for constructing exception to indicate that input JSON
* String was not suitable for deserializing into given target type.
* Note that most of the time this method should NOT be called; instead,
* {@link #handleWeirdStringValue} should be called which will call this method
* if necessary.
*
* @param value String value from input being deserialized
* @param instClass Type that String should be deserialized into
* @param msg Message that describes specific problem
*
* @since 2.1
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
*/
public JsonMappingException weirdStringException(String value, Class<?> instClass,
String msg) {
return InvalidFormatException.from(_parser,
String.format("Can not deserialize value of type %s from String %s: %s",
instClass.getName(), _quotedString(value), msg),
value, instClass);
}
/**
* Helper method for constructing exception to indicate that input JSON
* Number was not suitable for deserializing into given target type.
* Note that most of the time this method should NOT be called; instead,
* {@link #handleWeirdNumberValue} should be called which will call this method
* if necessary.
*/
public JsonMappingException weirdNumberException(Number value, Class<?> instClass,
String msg) {
return InvalidFormatException.from(_parser,
String.format("Can not deserialize value of type %s from number %s: %s",
instClass.getName(), String.valueOf(value), msg),
value, instClass);
}
/**
* Helper method for constructing instantiation exception for specified type,
* to indicate problem with physically constructing instance of
* specified class (missing constructor, exception from constructor)
*<p>
* Note that most of the time this method should NOT be called; instead,
* {@link #handleInstantiationProblem} should be called which will call this method
* if necessary.
*/
public JsonMappingException instantiationException(Class<?> instClass, Throwable t) {
return JsonMappingException.from(_parser,
String.format("Can not construct instance of %s, problem: %s",
instClass.getName(), t.getMessage()), t);
}
/**
* Helper method for constructing instantiation exception for specified type,
* to indicate that instantiation failed due to missing instantiator
* (creator; constructor or factory method).
*<p>
* Note that most of the time this method should NOT be called; instead,
* {@link #handleMissingInstantiator} should be called which will call this method
* if necessary.
*/
public JsonMappingException instantiationException(Class<?> instClass, String msg) {
return JsonMappingException.from(_parser,
String.format("Can not construct instance of %s: %s",
instClass.getName(), msg));
}
/**
* Helper method for constructing exception to
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> indicate that given type id
* could not be resolved to a valid subtype of specified base type, during
* polymorphic deserialization.
*<p>
* Note that most of the time this method should NOT be called; instead,
* {@link #handleUnknownTypeId} should be called which will call this method
* if necessary.
*/
public JsonMappingException unknownTypeIdException(JavaType baseType, String typeId,
String extraDesc) {
String msg = String.format("Could not resolve type id '%s' into a subtype of %s",
typeId, baseType);
if (extraDesc != null) {
msg = msg + ": "+extraDesc;
}
return InvalidTypeIdException.from(_parser, msg, baseType, typeId);
}
/*
/**********************************************************
/* Deprecated exception factory methods
/**********************************************************
*/
/**
* @since 2.5
*
* @deprecated Since 2.8 use {@link #handleUnknownTypeId} instead
*/
@Deprecated
public JsonMappingException unknownTypeException(JavaType type, String id,
String extraDesc) {
String msg = String.format("Could not resolve type id '%s' into a subtype of %s",
id, type);
if (extraDesc != null) {
msg = msg + ": "+extraDesc;
}
return JsonMappingException.from(_parser, msg);
}
/**
* Helper method for constructing exception to indicate that end-of-input was
* reached while still expecting more tokens to deserialize value of specified type.
*
* @deprecated Since 2.8; currently no way to catch EOF at databind level
*/
@Deprecated
public JsonMappingException endOfInputException(Class<?> instClass) {
return JsonMappingException.from(_parser, "Unexpected end-of-input when trying to deserialize a "
+instClass.getName());
}
/*
/**********************************************************
/* Other internal methods
/**********************************************************
*/
protected DateFormat getDateFormat()
{
if (_dateFormat != null) {
return _dateFormat;
}
/* 24-Feb-2012, tatu: At this point, all timezone configuration
* should have occurred, with respect to default dateformat
* and timezone configuration. But we still better clone
*
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> an instance as formatters may be stateful.
*/
DateFormat df = _config.getDateFormat();
_dateFormat = df = (DateFormat) df.clone();
return df;
}
protected String determineClassName(Object instance) {
return ClassUtil.getClassDescription(instance);
}
protected String _calcName(Class<?> cls) {
if (cls.isArray()) {
return _calcName(cls.getComponentType())+"[]";
}
return cls.getName();
}
protected String _valueDesc() {
try {
return _desc(_parser.getText());
} catch (Exception e) {
return "[N/A]";
}
}
protected String _desc(String desc) {
if (desc == null) {
return "[N/A]";
}
// !!! should we quote it? (in case there are control chars, linefeeds)
if (desc.length() > MAX_ERROR_STR_LEN) {
desc = desc.substring(0, MAX_ERROR_STR_LEN) + "]...[" + desc.substring(desc.length() - MAX_ERROR_STR_LEN);
}
return desc;
}
// @since 2.7
protected String _quotedString(String desc) {
if (desc == null) {
return "[N/A]";
}
// !!! should we quote it? (in case there are control chars, linefeeds)
if (desc.length() > MAX_ERROR_STR_LEN) {
return String.format("\"%s]...[%s\"",
desc.substring(0, MAX_ERROR_STR_LEN),
desc.substring(desc.length() - MAX_ERROR_STR_LEN));
}
return "\"" + desc + "\"";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS><Object, Object> _internalSettings;
/*
/***********************************************************
/* Construction, configuration
/***********************************************************
*/
@SuppressWarnings("unchecked")
public BeanPropertyWriter(BeanPropertyDefinition propDef,
AnnotatedMember member, Annotations contextAnnotations,
JavaType declaredType, JsonSerializer<?> ser,
TypeSerializer typeSer, JavaType serType, boolean suppressNulls,
Object suppressableValue) {
super(propDef);
_member = member;
_contextAnnotations = contextAnnotations;
_name = new SerializedString(propDef.getName());
_wrapperName = propDef.getWrapperName();
_includeInViews = propDef.findViews();
_declaredType = declaredType;
_serializer = (JsonSerializer<Object>) ser;
_dynamicSerializers = (ser == null) ? PropertySerializerMap
.emptyForProperties() : null;
_typeSerializer = typeSer;
_cfgSerializationType = serType;
if (member instanceof AnnotatedField) {
_accessorMethod = null;
_field = (Field) member.getMember();
} else if (member instanceof AnnotatedMethod) {
_accessorMethod = (Method) member.getMember();
_field = null;
} else {
// 01-Dec-2014, tatu: Used to be illegal, but now explicitly allowed
// for virtual props
_accessorMethod = null;
_field = null;
}
_suppressNulls = suppressNulls;
_suppressableValue = suppressableValue;
// this will be resolved later on, unless nulls are to be suppressed
_nullSerializer = null;
}
/**
* Constructor that may be of use to virtual properties, when there is need
* for the zero-arg ("default") constructor, and actual initialization is
* done after constructor call.
*
* @since 2.5
*/
protected BeanPropertyWriter() {
super(PropertyMetadata.STD_REQUIRED_OR_OPTIONAL);
_member = null;
_contextAnnotations = null;
_name = null;
_wrapperName = null;
_includeInViews = null;
_declaredType = null;
_serializer = null;
_dynamicSerializers = null;
_typeSerializer = null;
_cfgSerializationType = null;
_accessor
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> dynamic serialization resolution for complex (usually
* container) types
*/
public void setNonTrivialBaseType(JavaType t) {
_nonTrivialBaseType = t;
}
/**
* Method called to ensure that the mutator has proper access rights to
* be called, as per configuration. Overridden by implementations that
* have mutators that require access, fields and setters.
*
* @since 2.8.3
*/
public void fixAccess(SerializationConfig config) {
_member.fixAccess(config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS));
}
/*
/***********************************************************
/* JDK Serializability
/***********************************************************
*/
/*
* Ideally would not require mutable state, and instead would re-create with
* final settings. However, as things are, with sub-types and all, simplest
* to just change Field/Method value directly.
*/
Object readResolve() {
if (_member instanceof AnnotatedField) {
_accessorMethod = null;
_field = (Field) _member.getMember();
} else if (_member instanceof AnnotatedMethod) {
_accessorMethod = (Method) _member.getMember();
_field = null;
}
if (_serializer == null) {
_dynamicSerializers = PropertySerializerMap.emptyForProperties();
}
return this;
}
/*
/************************************************************
/* BeanProperty impl
/***********************************************************
*/
// Note: also part of 'PropertyWriter'
@Override
public String getName() {
return _name.getValue();
}
// Note: also part of 'PropertyWriter'
@Override
public PropertyName getFullName() { // !!! TODO: impl properly
return new PropertyName(_name.getValue());
}
@Override
public JavaType getType() {
return _declaredType;
}
@Override
public PropertyName getWrapperName() {
return _wrapperName;
}
// Note: also part of 'PropertyWriter'
@Override
public <A extends Annotation> A getAnnotation(Class<A> acls) {
return (_member == null) ? null : _member.getAnnotation(acls);
}
// Note: also part of 'PropertyWriter'
@Override
public <A extends Annotation> A getContextAnnotation(Class<A
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>> acls) {
return (_contextAnnotations == null) ? null : _contextAnnotations
.get(acls);
}
@Override
public AnnotatedMember getMember() {
return _member;
}
// @since 2.3 -- needed so it can be overridden by unwrapping writer
protected void _depositSchemaProperty(ObjectNode propertiesNode,
JsonNode schemaNode) {
propertiesNode.set(getName(), schemaNode);
}
/*
/***********************************************************
/* Managing and accessing of opaque internal settings
/* (used by extensions)
/***********************************************************
*/
/**
* Method for accessing value of specified internal setting.
*
* @return Value of the setting, if any; null if none.
*/
public Object getInternalSetting(Object key) {
return (_internalSettings == null) ? null : _internalSettings.get(key);
}
/**
* Method for setting specific internal setting to given value
*
* @return Old value of the setting, if any (null if none)
*/
public Object setInternalSetting(Object key, Object value) {
if (_internalSettings == null) {
_internalSettings = new HashMap<Object, Object>();
}
return _internalSettings.put(key, value);
}
/**
* Method for removing entry for specified internal setting.
*
* @return Existing value of the setting, if any (null if none)
*/
public Object removeInternalSetting(Object key) {
Object removed = null;
if (_internalSettings != null) {
removed = _internalSettings.remove(key);
// to reduce memory usage, let's also drop the Map itself, if empty
if (_internalSettings.size() == 0) {
_internalSettings = null;
}
}
return removed;
}
/*
/***********************************************************
/* Accessors
/***********************************************************
*/
public SerializableString getSerializedName() {
return _name;
}
public boolean hasSerializer() {
return _serializer != null;
}
public boolean hasNullSerializer() {
return _nullSerializer != null;
}
/**
* @since 2.6
*/
public TypeSerializer getTypeSerializer() {
return _typeSerializer;
}
/**
* Accessor that will return true if this bean property has to support
* "un
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer
// (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
prov.reportMappingProblem("Direct self-reference leading to cycle");
}
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(40);
sb.append("property '").append(getName()).append("' (");
if (_accessorMethod != null) {
sb.append("via method ")
.append(_accessorMethod.getDeclaringClass().getName())
.append("#").append(_accessorMethod.getName());
} else if (_field != null) {
sb.append("field \"").append(_field.getDeclaringClass().getName())
.append("#").append(_field.getName());
} else {
sb.append("virtual");
}
if (_serializer == null) {
sb.append(", no static serializer");
} else {
sb.append(", static serializer of type "
+ _serializer.getClass().getName());
}
sb.append(')');
return sb.toString();
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.deser.std;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashSet;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
/**
* Container class for deserializers that handle core JDK primitive
* (and matching wrapper) types, as well as standard "big" numeric types.
* Note that this includes types such as {@link java.lang.Boolean}
* and {@link java.lang.Character} which are not strictly numeric,
* but are part of primitive/wrapper types.
*/
public class NumberDeserializers
{
private final static HashSet<String> _classNames = new HashSet<String>();
static {
// note: can skip primitive types; other ways to check them:
Class<?>[] numberTypes = new Class<?>[] {
Boolean.class,
Byte.class,
Short.class,
Character.class,
Integer.class,
Long.class,
Float.class,
Double.class,
// and more generic ones
Number.class, BigDecimal.class, BigInteger.class
};
for (Class<?> cls : numberTypes) {
_classNames.add(cls.getName());
}
}
public static JsonDeserializer<?> find(Class<?> rawType, String clsName) {
if (rawType.isPrimitive()) {
if (rawType == Integer.TYPE) {
return IntegerDeserializer.primitiveInstance;
}
if (rawType == Boolean.TYPE) {
return BooleanDeserializer.primitiveInstance;
}
if (rawType == Long.TYPE) {
return LongDeserializer.primitiveInstance;
}
if (rawType == Double.TYPE) {
return DoubleDeserializer.primitiveInstance;
}
if (rawType == Character.TYPE) {
return CharacterDeserializer.primitiveInstance;
}
if (rawType == Byte.TYPE) {
return ByteDeserializer.primitiveInstance;
}
if (rawType == Short.TYPE) {
return ShortDeserializer.primitiveInstance;
}
if (rawType == Float.TYPE) {
return
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> FloatDeserializer.primitiveInstance;
}
} else if (_classNames.contains(clsName)) {
// Start with most common types; int, boolean, long, double
if (rawType == Integer.class) {
return IntegerDeserializer.wrapperInstance;
}
if (rawType == Boolean.class) {
return BooleanDeserializer.wrapperInstance;
}
if (rawType == Long.class) {
return LongDeserializer.wrapperInstance;
}
if (rawType == Double.class) {
return DoubleDeserializer.wrapperInstance;
}
if (rawType == Character.class) {
return CharacterDeserializer.wrapperInstance;
}
if (rawType == Byte.class) {
return ByteDeserializer.wrapperInstance;
}
if (rawType == Short.class) {
return ShortDeserializer.wrapperInstance;
}
if (rawType == Float.class) {
return FloatDeserializer.wrapperInstance;
}
if (rawType == Number.class) {
return NumberDeserializer.instance;
}
if (rawType == BigDecimal.class) {
return BigDecimalDeserializer.instance;
}
if (rawType == BigInteger.class) {
return BigIntegerDeserializer.instance;
}
} else {
return null;
}
// should never occur
throw new IllegalArgumentException("Internal error: can't find deserializer for "+rawType.getName());
}
/*
/**********************************************************
/* Then one intermediate base class for things that have
/* both primitive and wrapper types
/**********************************************************
*/
protected abstract static class PrimitiveOrWrapperDeserializer<T>
extends StdScalarDeserializer<T>
{
private static final long serialVersionUID = 1L;
protected final T _nullValue;
protected final boolean _primitive;
protected PrimitiveOrWrapperDeserializer(Class<T> vc, T nvl) {
super(vc);
_nullValue = nvl;
_primitive = vc.isPrimitive();
}
@Override
public final T getNullValue(DeserializationContext ctxt) throws JsonMappingException
{
if (_primitive && ctxt.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES)) {
ctxt.reportMappingException(
"Can not map JSON null into type %s (set DeserializationConfig.DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to '
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> to indicate problem as soon as possible.
*/
if (getClass() != BeanSerializerFactory.class) {
throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName()
+") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with "
+"additional serializer definitions");
}
return new BeanSerializerFactory(config);
}
@Override
protected Iterable<Serializers> customSerializers() {
return _factoryConfig.serializers();
}
/*
/**********************************************************
/* SerializerFactory impl
/**********************************************************
*/
/**
* Main serializer constructor method. We will have to be careful
* with respect to ordering of various method calls: essentially
* we want to reliably figure out which classes are standard types,
* and which are beans. The problem is that some bean Classes may
* implement standard interfaces (say, {@link java.lang.Iterable}.
*<p>
* Note: sub-classes may choose to complete replace implementation,
* if they want to alter priority of serializer lookups.
*/
@Override
@SuppressWarnings("unchecked")
public JsonSerializer<Object> createSerializer(SerializerProvider prov,
JavaType origType)
throws JsonMappingException
{
// Very first thing, let's check if there is explicit serializer annotation:
final SerializationConfig config = prov.getConfig();
BeanDescription beanDesc = config.introspect(origType);
JsonSerializer<?> ser = findSerializerFromAnnotation(prov, beanDesc.getClassInfo());
if (ser != null) {
return (JsonSerializer<Object>) ser;
}
boolean staticTyping;
// Next: we may have annotations that further indicate actual type to use (a super type)
final AnnotationIntrospector intr = config.getAnnotationIntrospector();
JavaType type;
if (intr == null) {
type = origType;
} else {
try {
type = intr.refineSerializationType(config, beanDesc.getClassInfo(), origType);
} catch (JsonMappingException e) {
return prov.reportBadTypeDefinition(beanDesc, e.getMessage());
}
}
if (type == origType) { // no changes, won't force static typing
staticTyping = false;
} else { // changes; assume static typing; plus, need to re-introspect if class differs
staticTyping = true
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>MapSerializer():
boolean staticTyping = config.isEnabled(MapperFeature.USE_STATIC_TYPING);
JavaType valueType = type.getContentType();
TypeSerializer typeSer = createTypeSerializer(config, valueType);
// last 2 nulls; don't know key, value serializers (yet)
// 23-Feb-2015, tatu: As per [databind#705], need to support custom serializers
JsonSerializer<?> anySer = findSerializerFromAnnotation(prov, anyGetter);
if (anySer == null) {
// TODO: support '@JsonIgnoreProperties' with any setter?
anySer = MapSerializer.construct(/* ignored props*/ (Set<String>) null,
type, staticTyping, typeSer, null, null, /*filterId*/ null);
}
// TODO: can we find full PropertyName?
PropertyName name = PropertyName.construct(anyGetter.getName());
BeanProperty.Std anyProp = new BeanProperty.Std(name, valueType, null,
beanDesc.getClassAnnotations(), anyGetter, PropertyMetadata.STD_OPTIONAL);
builder.setAnyGetter(new AnyGetterWriter(anyProp, anyGetter, anySer));
}
// Next: need to gather view information, if any:
processViews(config, builder);
// Finally: let interested parties mess with the result bit more...
if (_factoryConfig.hasSerializerModifiers()) {
for (BeanSerializerModifier mod : _factoryConfig.serializerModifiers()) {
builder = mod.updateBuilder(config, beanDesc, builder);
}
}
JsonSerializer<Object> ser = (JsonSerializer<Object>) builder.build();
if (ser == null) {
// If we get this far, there were no properties found, so no regular BeanSerializer
// would be constructed. But, couple of exceptions.
// First: if there are known annotations, just create 'empty bean' serializer
if (beanDesc.hasKnownClassAnnotations()) {
return builder.createDummy();
}
}
return ser;
}
protected ObjectIdWriter constructObjectIdHandler(SerializerProvider prov,
BeanDescription beanDesc, List<BeanPropertyWriter> props)
throws JsonMappingException
{
ObjectIdInfo objectIdInfo = beanDesc.getObjectIdInfo();
if (objectIdInfo == null) {
return null;
}
ObjectIdGenerator
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS><?> gen;
Class<?> implClass = objectIdInfo.getGeneratorType();
// Just one special case: Property-based generator is trickier
if (implClass == ObjectIdGenerators.PropertyGenerator.class) { // most special one, needs extra work
String propName = objectIdInfo.getPropertyName().getSimpleName();
BeanPropertyWriter idProp = null;
for (int i = 0, len = props.size() ;; ++i) {
if (i == len) {
throw new IllegalArgumentException("Invalid Object Id definition for "+beanDesc.getBeanClass().getName()
+": can not find property with name '"+propName+"'");
}
BeanPropertyWriter prop = props.get(i);
if (propName.equals(prop.getName())) {
idProp = prop;
/* Let's force it to be the first property to output
* (although it may still get rearranged etc)
*/
if (i > 0) {
props.remove(i);
props.add(0, idProp);
}
break;
}
}
JavaType idType = idProp.getType();
gen = new PropertyBasedObjectIdGenerator(objectIdInfo, idProp);
// one more thing: must ensure that ObjectIdWriter does not actually write the value:
return ObjectIdWriter.construct(idType, (PropertyName) null, gen, objectIdInfo.getAlwaysAsId());
}
// other types are simpler
JavaType type = prov.constructType(implClass);
// Could require type to be passed explicitly, but we should be able to find it too:
JavaType idType = prov.getTypeFactory().findTypeParameters(type, ObjectIdGenerator.class)[0];
gen = prov.objectIdGeneratorInstance(beanDesc.getClassInfo(), objectIdInfo);
return ObjectIdWriter.construct(idType, objectIdInfo.getPropertyName(), gen,
objectIdInfo.getAlwaysAsId());
}
/**
* Method called to construct a filtered writer, for given view
* definitions. Default implementation constructs filter that checks
* active view type to views property is to be included in.
*/
protected BeanPropertyWriter constructFilteredBeanWriter(BeanPropertyWriter writer,
Class<?>[] inViews)
{
return FilteredBeanPropertyWriter.constructViewBased(writer, inViews);
}
protected PropertyBuilder
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>accessor != null) {
builder.setTypeId(accessor);
}
continue;
}
// suppress writing of back references
AnnotationIntrospector.ReferenceProperty refType = property.findReferenceType();
if (refType != null && refType.isBackReference()) {
continue;
}
if (accessor instanceof AnnotatedMethod) {
result.add(_constructWriter(prov, property, pb, staticTyping, (AnnotatedMethod) accessor));
} else {
result.add(_constructWriter(prov, property, pb, staticTyping, (AnnotatedField) accessor));
}
}
return result;
}
/*
/**********************************************************
/* Overridable non-public methods for manipulating bean properties
/**********************************************************
*/
/**
* Overridable method that can filter out properties. Default implementation
* checks annotations class may have.
*/
protected List<BeanPropertyWriter> filterBeanProperties(SerializationConfig config,
BeanDescription beanDesc, List<BeanPropertyWriter> props)
{
// 01-May-2016, tatu: Which base type to use here gets tricky, since
// it may often make most sense to use general type for overrides,
// but what we have here may be more specific impl type. But for now
// just use it as is.
JsonIgnoreProperties.Value ignorals = config.getDefaultPropertyIgnorals(beanDesc.getBeanClass(),
beanDesc.getClassInfo());
if (ignorals != null) {
Set<String> ignored = ignorals.findIgnoredForSerialization();
if (!ignored.isEmpty()) {
Iterator<BeanPropertyWriter> it = props.iterator();
while (it.hasNext()) {
if (ignored.contains(it.next().getName())) {
it.remove();
}
}
}
}
return props;
}
/**
* Method called to handle view information for constructed serializer,
* based on bean property writers.
*<p>
* Note that this method is designed to be overridden by sub-classes
* if they want to provide custom view handling. As such it is not
* considered an internal implementation detail, and will be supported
* as part of API going forward.
*/
protected void processViews(SerializationConfig config, BeanSerializerBuilder builder)
{
// whether
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>getTypeFactory(), null);
}
public static AnnotatedClass constructWithoutSuperTypes(Class<?> cls, MapperConfig<?> config,
MixInResolver mir)
{
if (config == null) {
return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(),
Collections.<JavaType>emptyList(), null, null, null, null);
}
AnnotationIntrospector intr = config.isAnnotationProcessingEnabled()
? config.getAnnotationIntrospector() : null;
return new AnnotatedClass(null, cls, TypeBindings.emptyBindings(),
Collections.<JavaType>emptyList(), intr, mir, config.getTypeFactory(), null);
}
/*
/**********************************************************
/* TypeResolutionContext implementation
/**********************************************************
*/
@Override
public JavaType resolveType(Type type) {
return _typeFactory.constructType(type, _bindings);
}
/*
/**********************************************************
/* Annotated impl
/**********************************************************
*/
@Override
public Class<?> getAnnotated() { return _class; }
@Override
public int getModifiers() { return _class.getModifiers(); }
@Override
public String getName() { return _class.getName(); }
@Override
public <A extends Annotation> A getAnnotation(Class<A> acls) {
return _classAnnotations().get(acls);
}
@Override
public boolean hasAnnotation(Class<?> acls) {
return _classAnnotations().has(acls);
}
@Override
public boolean hasOneOf(Class<? extends Annotation>[] annoClasses) {
return _classAnnotations().hasOneOf(annoClasses);
}
@Override
public Class<?> getRawType() {
return _class;
}
@Override
public Iterable<Annotation> annotations() {
return _classAnnotations().annotations();
}
@Override
protected AnnotationMap getAllAnnotations() {
return _classAnnotations();
}
@Override
public JavaType getType() {
return _type;
}
/*
/**********************************************************
/* Public API, generic accessors
/**********************************************************
*/
public Annotations getAnnotations() {
return _classAnnotations();
}
public boolean hasAnnotations() {
return _classAnnotations().size() > 0;
}
public AnnotatedConstructor getDefaultConstructor()
{
if (!_creatorsResolved) {
resolveCreators();
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>-ins? Most likely error cases (not matching
* any method); but there is one possible real use case:
* exposing Object#hashCode (alas, Object#getClass can NOT be
* exposed)
*/
// 14-Feb-2011, tatu: AnnotationIntrospector is null if annotations not enabled; if so, can skip:
if (_annotationIntrospector != null) {
if (!mixins.isEmpty()) {
Iterator<AnnotatedMethod> it = mixins.iterator();
while (it.hasNext()) {
AnnotatedMethod mixIn = it.next();
try {
Method m = Object.class.getDeclaredMethod(mixIn.getName(), mixIn.getRawParameterTypes());
if (m != null) {
// Since it's from java.lang.Object, no generics, no need for real type context:
AnnotatedMethod am = _constructMethod(m, this);
_addMixOvers(mixIn.getAnnotated(), am, false);
_memberMethods.add(am);
}
} catch (Exception e) { }
}
}
}
}
/**
* Method that will collect all member (non-static) fields
* that are either public, or have at least a single annotation
* associated with them.
*/
private void resolveFields()
{
Map<String,AnnotatedField> foundFields = _findFields(_type, this, null);
if (foundFields == null || foundFields.size() == 0) {
_fields = Collections.emptyList();
} else {
_fields = new ArrayList<AnnotatedField>(foundFields.size());
_fields.addAll(foundFields.values());
}
}
/*
/**********************************************************
/* Helper methods for resolving class annotations
/* (resolution consisting of inheritance, overrides,
/* and injection of mix-ins as necessary)
/**********************************************************
*/
/**
* Helper method for adding any mix-in annotations specified
* class might have.
*/
protected void _addClassMixIns(AnnotationMap annotations, JavaType target)
{
if (_mixInResolver != null) {
final Class<?> toMask = target.getRawClass();
_addClassMixIns(annotations, toMask, _mixInResolver.findMixInClassFor(toMask));
}
}
protected void _addClass
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> 03-Nov-2015, tatu: Mix-in method never called, should not need
// to resolve generic types, so this class is fine as context
mixIns.add(_constructMethod(m, this));
}
}
}
}
}
/*
/**********************************************************
/* Helper methods for populating field information
/**********************************************************
*/
protected Map<String,AnnotatedField> _findFields(JavaType type,
TypeResolutionContext typeContext, Map<String,AnnotatedField> fields)
{
/* First, a quick test: we only care for regular classes (not
* interfaces, primitive types etc), except for Object.class.
* A simple check to rule out other cases is to see if there
* is a super class or not.
*/
JavaType parent = type.getSuperClass();
if (parent != null) {
final Class<?> cls = type.getRawClass();
// Let's add super-class' fields first, then ours.
/* 21-Feb-2010, tatu: Need to handle masking: as per [JACKSON-226]
* we otherwise get into trouble...
*/
fields = _findFields(parent,
new TypeResolutionContext.Basic(_typeFactory, parent.getBindings()),
fields);
for (Field f : ClassUtil.getDeclaredFields(cls)) {
// static fields not included (transients are at this point, filtered out later)
if (!_isIncludableField(f)) {
continue;
}
/* Ok now: we can (and need) not filter out ignorable fields
* at this point; partly because mix-ins haven't been
* added, and partly because logic can be done when
* determining get/settability of the field.
*/
if (fields == null) {
fields = new LinkedHashMap<String,AnnotatedField>();
}
fields.put(f.getName(), _constructField(f, typeContext));
}
// And then... any mix-in overrides?
if (_mixInResolver != null) {
Class<?> mixin = _mixInResolver.findMixInClassFor(cls);
if (mixin != null) {
_addFieldMixIns(mixin, cls, fields);
}
}
}
return
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> fields;
}
/**
* Method called to add field mix-ins from given mix-in class (and its fields)
* into already collected actual fields (from introspected classes and their
* super-classes)
*/
protected void _addFieldMixIns(Class<?> mixInCls, Class<?> targetClass,
Map<String,AnnotatedField> fields)
{
List<Class<?>> parents = ClassUtil.findSuperClasses(mixInCls, targetClass, true);
for (Class<?> mixin : parents) {
for (Field mixinField : ClassUtil.getDeclaredFields(mixin)) {
// there are some dummy things (static, synthetic); better ignore
if (!_isIncludableField(mixinField)) {
continue;
}
String name = mixinField.getName();
// anything to mask? (if not, quietly ignore)
AnnotatedField maskedField = fields.get(name);
if (maskedField != null) {
_addOrOverrideAnnotations(maskedField, mixinField.getDeclaredAnnotations());
}
}
}
}
/*
/**********************************************************
/* Helper methods, constructing value types
/**********************************************************
*/
protected AnnotatedMethod _constructMethod(Method m, TypeResolutionContext typeContext)
{
/* note: parameter annotations not used for regular (getter, setter)
* methods; only for creator methods (static factory methods)
* -- at least not yet!
*/
if (_annotationIntrospector == null) { // when annotation processing is disabled
return new AnnotatedMethod(typeContext, m, _emptyAnnotationMap(), null);
}
return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()), null);
}
protected AnnotatedConstructor _constructDefaultConstructor(ClassUtil.Ctor ctor,
TypeResolutionContext typeContext)
{
if (_annotationIntrospector == null) { // when annotation processing is disabled
return new AnnotatedConstructor(typeContext, ctor.getConstructor(), _emptyAnnotationMap(), NO_ANNOTATION_MAPS);
}
return new AnnotatedConstructor(typeContext, ctor.getConstructor(),
_collectRelevantAnnotations(ctor.getDeclaredAnnotations()), NO_ANNOTATION_MAPS);
}
protected AnnotatedConstructor _constructNonDefaultConstructor(ClassUtil.Ctor ctor,
TypeResolutionContext typeContext)
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> for "+ctor.getDeclaringClass().getName()
+" has mismatch: "+paramCount+" parameters; "+paramAnns.length+" sets of annotations");
}
} else {
resolvedAnnotations = _collectRelevantAnnotations(paramAnns);
}
return new AnnotatedConstructor(typeContext, ctor.getConstructor(),
_collectRelevantAnnotations(ctor.getDeclaredAnnotations()), resolvedAnnotations);
}
protected AnnotatedMethod _constructCreatorMethod(Method m, TypeResolutionContext typeContext)
{
final int paramCount = m.getParameterTypes().length;
if (_annotationIntrospector == null) { // when annotation processing is disabled
return new AnnotatedMethod(typeContext, m, _emptyAnnotationMap(), _emptyAnnotationMaps(paramCount));
}
if (paramCount == 0) { // common enough we can slightly optimize
return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()),
NO_ANNOTATION_MAPS);
}
return new AnnotatedMethod(typeContext, m, _collectRelevantAnnotations(m.getDeclaredAnnotations()),
_collectRelevantAnnotations(m.getParameterAnnotations()));
}
protected AnnotatedField _constructField(Field f, TypeResolutionContext typeContext)
{
if (_annotationIntrospector == null) { // when annotation processing is disabled
return new AnnotatedField(typeContext, f, _emptyAnnotationMap());
}
return new AnnotatedField(typeContext, f, _collectRelevantAnnotations(f.getDeclaredAnnotations()));
}
private AnnotationMap _emptyAnnotationMap() {
return new AnnotationMap();
}
private AnnotationMap[] _emptyAnnotationMaps(int count) {
if (count == 0) {
return NO_ANNOTATION_MAPS;
}
AnnotationMap[] maps = new AnnotationMap[count];
for (int i = 0; i < count; ++i) {
maps[i] = _emptyAnnotationMap();
}
return maps;
}
/*
/**********************************************************
/* Helper methods, inclusion filtering
/**********************************************************
*/
protected boolean _isIncludableMemberMethod(Method m)
{
if (Modifier.isStatic(m.getModifiers())) {
return false;
}
/* 07-Apr-2009, tatu: Looks
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> this context.
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null){
// Nope... this is going to end poorly
throw ex;
}
final Class<?> contextClass;
try {
contextClass = loader.loadClass(cls.getName());
} catch (ClassNotFoundException e) {
// !!! TODO: 08-May-2015, tatu: Chain appropriately once we have JDK 1.7/Java7 as baseline
//ex.addSuppressed(e); Not until Jackson 2.7
throw ex;
}
return contextClass.getDeclaredMethods(); // Cross fingers
}
}
/*
/**********************************************************
/* Other methods
/**********************************************************
*/
@Override
public String toString() {
return "[AnnotedClass "+_class.getName()+"]";
}
@Override
public int hashCode() {
return _class.getName().hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
return ((AnnotatedClass) o)._class == _class;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.withBeanProperties(props),
_orderedProperties);
}
@Override
protected BeanDeserializerBase asArrayDeserializer() {
return this;
}
/*
/**********************************************************
/* JsonDeserializer implementation
/**********************************************************
*/
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
// Let's delegate just in case we got a JSON Object (could error out, alternatively?)
if (!p.isExpectedStartArrayToken()) {
return _deserializeFromNonArray(p, ctxt);
}
if (!_vanillaProcessing) {
return _deserializeNonVanilla(p, ctxt);
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
final SettableBeanProperty[] props = _orderedProperties;
int i = 0;
final int propCount = props.length;
while (true) {
if (p.nextToken() == JsonToken.END_ARRAY) {
return bean;
}
if (i == propCount) {
break;
}
SettableBeanProperty prop = props[i];
if (prop != null) { // normal case
try {
prop.deserializeAndSet(p, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
} else { // just skip?
p.skipChildren();
}
++i;
}
// Ok; extra fields? Let's fail, unless ignoring extra props is fine
if (!_ignoreAllUnknown) {
ctxt.reportWrongTokenException(p, JsonToken.END_ARRAY,
"Unexpected JSON values; expected at most %d properties (in JSON Array)",
propCount);
// never gets here
}
// otherwise, skip until end
do {
p.skipChildren();
} while (p.nextToken() != JsonToken.END_ARRAY);
return bean;
}
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt, Object bean)
throws IOException
{
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
/* No good way to verify that we
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> have an array... although could I guess
* check via JsonParser. So let's assume everything is working fine, for now.
*/
if (_injectables != null) {
injectValues(ctxt, bean);
}
final SettableBeanProperty[] props = _orderedProperties;
int i = 0;
final int propCount = props.length;
while (true) {
if (p.nextToken() == JsonToken.END_ARRAY) {
return bean;
}
if (i == propCount) {
break;
}
SettableBeanProperty prop = props[i];
if (prop != null) { // normal case
try {
prop.deserializeAndSet(p, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
} else { // just skip?
p.skipChildren();
}
++i;
}
// Ok; extra fields? Let's fail, unless ignoring extra props is fine
if (!_ignoreAllUnknown) {
ctxt.reportWrongTokenException(p, JsonToken.END_ARRAY,
"Unexpected JSON values; expected at most %d properties (in JSON Array)",
propCount);
// never gets here
}
// otherwise, skip until end
do {
p.skipChildren();
} while (p.nextToken() != JsonToken.END_ARRAY);
return bean;
}
// needed since 2.1
@Override
public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt)
throws IOException
{
return _deserializeFromNonArray(p, ctxt);
}
/*
/**********************************************************
/* Helper methods, non-standard creation
/**********************************************************
*/
/**
* Alternate deserialization method that has to check many more configuration
* aspects than the "vanilla" processing.
*/
protected Object _deserializeNonVanilla(JsonParser p, DeserializationContext ctxt)
throws IOException
{
if (_nonStandardCreation) {
return deserializeFromObjectUsingNonDefault(p, ctxt);
}
final Object bean = _valueInstantiator.createUsingDefault(ctxt);
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
if (_injectables != null) {
injectValues
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>(ctxt, bean);
}
Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null;
final SettableBeanProperty[] props = _orderedProperties;
int i = 0;
final int propCount = props.length;
while (true) {
if (p.nextToken() == JsonToken.END_ARRAY) {
return bean;
}
if (i == propCount) {
break;
}
SettableBeanProperty prop = props[i];
++i;
if (prop != null) { // normal case
if (activeView == null || prop.visibleInView(activeView)) {
try {
prop.deserializeAndSet(p, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
continue;
}
}
// otherwise, skip it (view-filtered, no prop etc)
p.skipChildren();
}
// Ok; extra fields? Let's fail, unless ignoring extra props is fine
if (!_ignoreAllUnknown) {
ctxt.reportWrongTokenException(p, JsonToken.END_ARRAY,
"Unexpected JSON values; expected at most %d properties (in JSON Array)",
propCount);
// will never reach here as exception has been thrown
}
// otherwise, skip until end
do {
p.skipChildren();
} while (p.nextToken() != JsonToken.END_ARRAY);
return bean;
}
/**
* Method called to deserialize bean using "property-based creator":
* this means that a non-default constructor or factory method is
* called, and then possibly other setters. The trick is that
* values for creator method need to be buffered, first; and
* due to non-guaranteed ordering possibly some other properties
* as well.
*/
@Override
protected final Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt)
throws IOException
{
final PropertyBasedCreator creator = _propertyBasedCreator;
PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader);
final SettableBeanProperty[] props = _orderedProperties;
final int propCount = props.length;
int i = 0;
Object bean = null;
for (; p.
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>nextToken() != JsonToken.END_ARRAY; ++i) {
SettableBeanProperty prop = (i < propCount) ? props[i] : null;
if (prop == null) { // we get null if there are extra elements; maybe otherwise too?
p.skipChildren();
continue;
}
// if we have already constructed POJO, things are simple:
if (bean != null) {
try {
prop.deserializeAndSet(p, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, prop.getName(), ctxt);
}
continue;
}
final String propName = prop.getName();
// if not yet, maybe we got a creator property?
SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
if (creatorProp != null) {
// Last creator property to set?
if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) {
try {
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
continue; // never gets here
}
// [databind#631]: Assign current value, to be accessible by custom serializers
p.setCurrentValue(bean);
// polymorphic?
if (bean.getClass() != _beanType.getRawClass()) {
/* 23-Jul-2012, tatu: Not sure if these could ever be properly
* supported (since ordering of elements may not be guaranteed);
* but make explicitly non-supported for now.
*/
ctxt.reportMappingException("Can not support implicit polymorphic deserialization for POJOs-as-Arrays style: "
+"nominal type %s, actual type %s",
_beanType.getRawClass().getName(), bean.getClass().getName());
}
}
continue;
}
// Object Id property?
if (buffer.readIdProperty(propName)) {
continue;
}
// regular property? needs buffering
buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
}
// In case we didn't quite get all the creator properties, we may have to do this:
if (bean == null) {
try {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
return wrapInstantiationProblem(e, ctxt);
}
}
return bean;
}
/*
/**********************************************************
/* Helper methods, error reporting
/**********************************************************
*/
protected Object _deserializeFromNonArray(JsonParser p, DeserializationContext ctxt)
throws IOException
{
return ctxt.handleUnexpectedToken(handledType(), p.getCurrentToken(), p,
"Can not deserialize a POJO (of type %s) from non-Array representation (token: %s): "
+"type/property designed to be serialized as JSON Array",
_beanType.getRawClass().getName(),
p.getCurrentToken());
// in future, may allow use of "standard" POJO serialization as well; if so, do:
//return _delegate.deserialize(p, ctxt);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> try {
for (final int len = props.length; i < len; ++i) {
BeanPropertyWriter prop = props[i];
if (prop == null) { // can have nulls in filtered list; but if so, MUST write placeholders
gen.writeNull();
} else {
prop.serializeAsElement(bean, gen, provider);
}
}
// NOTE: any getters can not be supported either
//if (_anyGetterWriter != null) {
// _anyGetterWriter.getAndSerialize(bean, gen, provider);
//}
} catch (Exception e) {
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
wrapAndThrow(provider, e, bean, name);
} catch (StackOverflowError e) {
JsonMappingException mapE = JsonMappingException.from(gen, "Infinite recursion (StackOverflowError)", e);
String name = (i == props.length) ? "[anySetter]" : props[i].getName();
mapE.prependPath(new JsonMappingException.Reference(bean, name));
throw mapE;
}
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override public String toString() {
return "BeanAsArraySerializer for "+handledType().getName();
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.util;
import com.fasterxml.jackson.databind.JavaType;
/**
* Key that offers two "modes"; one with raw class, as used for
* cases were raw class type is available (for example, when using
* runtime type); and one with full generics-including.
*/
public class TypeKey
{
protected int _hashCode;
protected Class<?> _class;
protected JavaType _type;
/**
* Indicator of whether serializer stored has a type serializer
* wrapper around it or not; if not, it is "untyped" serializer;
* if it has, it is "typed"
*/
protected boolean _isTyped;
public TypeKey() { }
public TypeKey(TypeKey src) {
_hashCode = src._hashCode;
_class = src._class;
_type = src._type;
_isTyped = src._isTyped;
}
public TypeKey(Class<?> key, boolean typed) {
_class = key;
_type = null;
_isTyped = typed;
_hashCode = typed ? typedHash(key) : untypedHash(key);
}
public TypeKey(JavaType key, boolean typed) {
_type = key;
_class = null;
_isTyped = typed;
_hashCode = typed ? typedHash(key) : untypedHash(key);
}
public final static int untypedHash(Class<?> cls) {
return cls.getName().hashCode();
}
public final static int typedHash(Class<?> cls) {
return cls.getName().hashCode()+1;
}
public final static int untypedHash(JavaType type) {
return type.hashCode() - 1;
}
public final static int typedHash(JavaType type) {
return type.hashCode() - 2;
}
public final void resetTyped(Class<?> cls) {
_type = null;
_class = cls;
_isTyped = true;
_hashCode = typedHash(cls);
}
public final void resetUntyped(Class<?> cls) {
_type = null;
_class = cls;
_isTyped = false;
_hashCode = untypedHash(cls);
}
public final void resetTyped(JavaType type) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> _type = type;
_class = null;
_isTyped = true;
_hashCode = typedHash(type);
}
public final void resetUntyped(JavaType type) {
_type = type;
_class = null;
_isTyped = false;
_hashCode = untypedHash(type);
}
public boolean isTyped() {
return _isTyped;
}
public Class<?> getRawType() {
return _class;
}
public JavaType getType() {
return _type;
}
@Override public final int hashCode() { return _hashCode; }
@Override public final String toString() {
if (_class != null) {
return "{class: "+_class.getName()+", typed? "+_isTyped+"}";
}
return "{type: "+_type+", typed? "+_isTyped+"}";
}
// note: we assume key is never used for anything other than as map key, so:
@Override public final boolean equals(Object o)
{
if (o == null) return false;
if (o == this) return true;
if (o.getClass() != getClass()) {
return false;
}
TypeKey other = (TypeKey) o;
if (other._isTyped == _isTyped) {
if (_class != null) {
return other._class == _class;
}
return _type.equals(other._type);
}
return false;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.ser.std;
import java.io.IOException;
import java.lang.reflect.Type;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
/**
* Also: default bean access will not do much good with Class.class. But
* we can just serialize the class name and that should be enough.
*/
@SuppressWarnings("serial")
public class ClassSerializer
extends StdScalarSerializer<Class<?>>
{
public ClassSerializer() { super(Class.class, false); }
@Override
public void serialize(Class<?> value, JsonGenerator g, SerializerProvider provider) throws IOException
{
g.writeString(value.getName());
}
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
{
return createSchemaNode("string", true);
}
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
visitStringFormat(visitor, typeHint);
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> if (raw == Currency.class) {
FromStringDeserializer<?> deser = FromStringDeserializer.findDeserializer(Currency.class);
return new StdKeyDeserializer(TYPE_CURRENCY, raw, deser);
} else {
return null;
}
return new StdKeyDeserializer(kind, raw);
}
@Override
public Object deserializeKey(String key, DeserializationContext ctxt)
throws IOException
{
if (key == null) { // is this even legal call?
return null;
}
try {
Object result = _parse(key, ctxt);
if (result != null) {
return result;
}
} catch (Exception re) {
return ctxt.handleWeirdKey(_keyClass, key, "not a valid representation, problem: (%s) %s",
re.getClass().getName(), re.getMessage());
}
if (_keyClass.isEnum() && ctxt.getConfig().isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)) {
return null;
}
return ctxt.handleWeirdKey(_keyClass, key, "not a valid representation");
}
public Class<?> getKeyClass() { return _keyClass; }
protected Object _parse(String key, DeserializationContext ctxt) throws Exception
{
switch (_kind) {
case TYPE_BOOLEAN:
if ("true".equals(key)) {
return Boolean.TRUE;
}
if ("false".equals(key)) {
return Boolean.FALSE;
}
return ctxt.handleWeirdKey(_keyClass, key, "value not 'true' or 'false'");
case TYPE_BYTE:
{
int value = _parseInt(key);
// allow range up to 255, inclusive (to support "unsigned" byte)
if (value < Byte.MIN_VALUE || value > 255) {
return ctxt.handleWeirdKey(_keyClass, key, "overflow, value can not be represented as 8-bit value");
}
return Byte.valueOf((byte) value);
}
case TYPE_SHORT:
{
int value = _parseInt(key);
if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
return ctxt.handleWeirdKey(_keyClass, key, "overflow, value can not be represented
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.deser.std;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
/**
* Intermediate base deserializer class that adds more shared accessor
* so that other classes can access information about contained (value) types
*/
@SuppressWarnings("serial")
public abstract class ContainerDeserializerBase<T>
extends StdDeserializer<T>
{
protected ContainerDeserializerBase(JavaType selfType) {
super(selfType);
}
/*
/**********************************************************
/* Overrides
/**********************************************************
*/
@Override
public SettableBeanProperty findBackReference(String refName) {
JsonDeserializer<Object> valueDeser = getContentDeserializer();
if (valueDeser == null) {
throw new IllegalArgumentException("Can not handle managed/back reference '"+refName
+"': type: container deserializer of type "+getClass().getName()+" returned null for 'getContentDeserializer()'");
}
return valueDeser.findBackReference(refName);
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Accessor for declared type of contained value elements; either exact
* type, or one of its supertypes.
*/
public abstract JavaType getContentType();
/**
* Accesor for deserializer use for deserializing content values.
*/
public abstract JsonDeserializer<Object> getContentDeserializer();
/*
/**********************************************************
/* Shared methods for sub-classes
/**********************************************************
*/
/**
* Helper method called by various Map(-like) deserializers.
*/
protected void wrapAndThrow(Throwable t, Object ref, String key) throws IOException
{
// to handle StackOverflow:
while (t instanceof InvocationTargetException && t.getCause() != null) {
t = t.getCause();
}
// Errors and "plain" IOExceptions to be passed as is
if (t instanceof Error) {
throw (Error) t;
}
// ... except for mapping exceptions
if (t instanceof IOException && !(t instanceof JsonMappingException)) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>03], `getSimpleName()` not so good
// as it drops enclosing class. So let's try bit different approach
int arrays = 0;
while (cls.isArray()) {
cls = cls.getComponentType();
++arrays;
}
sb.append(cls.getName());
while (--arrays >= 0) {
sb.append("[]");
}
/* was:
String pkgName = ClassUtil.getPackageName(cls);
if (pkgName != null) {
sb.append(pkgName);
sb.append('.');
}
*/
}
sb.append('[');
if (_fieldName != null) {
sb.append('"');
sb.append(_fieldName);
sb.append('"');
} else if (_index >= 0) {
sb.append(_index);
} else {
sb.append('?');
}
sb.append(']');
_desc = sb.toString();
}
return _desc;
}
@Override
public String toString() {
return getDescription();
}
/**
* May need some cleaning here, given that `from` may or may not be serializable.
*
* since 2.8
*/
Object writeReplace() {
// as per [databind#1195], need to ensure description is not null, since
// `_from` is transient
getDescription();
return this;
}
}
/*
/**********************************************************
/* State/configuration
/**********************************************************
*/
/**
* Path through which problem that triggering throwing of
* this exception was reached.
*/
protected LinkedList<Reference> _path;
/**
* Underlying processor ({@link JsonParser} or {@link JsonGenerator}),
* if known.
*<p>
* NOTE: typically not serializable hence <code>transient</code>
*
* @since 2.7
*/
protected transient Closeable _processor;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
@Deprecated // since 2.7
public JsonMappingException(String msg) { super(msg); }
/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>.7
*/
public static JsonMappingException from(JsonGenerator g, String msg, Throwable problem) {
return new JsonMappingException(g, msg, problem);
}
/**
* @since 2.7
*/
public static JsonMappingException from(DeserializationContext ctxt, String msg) {
return new JsonMappingException(ctxt.getParser(), msg);
}
/**
* @since 2.7
*/
public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t) {
return new JsonMappingException(ctxt.getParser(), msg, t);
}
/**
* @since 2.7
*/
public static JsonMappingException from(SerializerProvider ctxt, String msg) {
return new JsonMappingException(ctxt.getGenerator(), msg);
}
/**
* @since 2.7
*/
public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem) {
/* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as
* SerializerProvider instance does not currently hold on to generator...
*/
return new JsonMappingException(ctxt.getGenerator(), msg, problem);
}
/**
* Factory method used when "upgrading" an {@link IOException} into
* {@link JsonMappingException}: usually only needed to comply with
* a signature.
*
* @since 2.1
*/
public static JsonMappingException fromUnexpectedIOE(IOException src) {
return new JsonMappingException(null,
String.format("Unexpected IOException (of type %s): %s",
src.getClass().getName(), src.getMessage()));
}
/**
* Method that can be called to either create a new JsonMappingException
* (if underlying exception is not a JsonMappingException), or augment
* given exception with given path/reference information.
*
* This version of method is called when the reference is through a
* non-indexed object, such as a Map or POJO/bean.
*/
public static JsonMappingException wrapWithPath(Throwable src, Object refFrom,
String refFieldName) {
return wrapWithPath(src, new Reference(refFrom, refFieldName));
}
/**
* Method that can be called to either create a new JsonMapping
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Exception
* (if underlying exception is not a JsonMappingException), or augment
* given exception with given path/reference information.
*
* This version of method is called when the reference is through an
* index, which happens with arrays and Collections.
*/
public static JsonMappingException wrapWithPath(Throwable src, Object refFrom, int index) {
return wrapWithPath(src, new Reference(refFrom, index));
}
/**
* Method that can be called to either create a new JsonMappingException
* (if underlying exception is not a JsonMappingException), or augment
* given exception with given path/reference information.
*/
@SuppressWarnings("resource")
public static JsonMappingException wrapWithPath(Throwable src, Reference ref)
{
JsonMappingException jme;
if (src instanceof JsonMappingException) {
jme = (JsonMappingException) src;
} else {
String msg = src.getMessage();
// Let's use a more meaningful placeholder if all we have is null
if (msg == null || msg.length() == 0) {
msg = "(was "+src.getClass().getName()+")";
}
// 17-Aug-2015, tatu: Let's also pass the processor (parser/generator) along
Closeable proc = null;
if (src instanceof JsonProcessingException) {
Object proc0 = ((JsonProcessingException) src).getProcessor();
if (proc0 instanceof Closeable) {
proc = (Closeable) proc0;
}
}
jme = new JsonMappingException(proc, msg, src);
}
jme.prependPath(ref);
return jme;
}
/*
/**********************************************************
/* Accessors/mutators
/**********************************************************
*/
/**
* Method for accessing full structural path within type hierarchy
* down to problematic property.
*/
public List<Reference> getPath()
{
if (_path == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(_path);
}
/**
* Method for accessing description of path that lead to the
* problem that triggered this exception
*/
public String getPathReference()
{
return getPathReference(new StringBuilder()).toString();
}
public StringBuilder getPathReference(StringBuilder sb)
{
_appendPathDesc(sb);
return
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> public String toString()
{
return getClass().getName()+": "+getMessage();
}
/*
/**********************************************************
/* Internal methods
/**********************************************************
*/
protected void _appendPathDesc(StringBuilder sb)
{
if (_path == null) {
return;
}
Iterator<Reference> it = _path.iterator();
while (it.hasNext()) {
sb.append(it.next().toString());
if (it.hasNext()) {
sb.append("->");
}
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> serializer of type %s)",
clz.getName(), getClass().getName());
}
/*
/**********************************************************
/* Other accessors
/**********************************************************
*/
/**
* Method for accessing type of Objects this serializer can handle.
* Note that this information is not guaranteed to be exact -- it
* may be a more generic (super-type) -- but it should not be
* incorrect (return a non-related type).
*<p>
* Default implementation will return null, which essentially means
* same as returning <code>Object.class</code> would; that is, that
* nothing is known about handled type.
*<p>
*/
public Class<T> handledType() { return null; }
/**
* Method called to check whether given serializable value is
* considered "empty" value (for purposes of suppressing serialization
* of empty values).
*<p>
* Default implementation will consider only null values to be empty.
*
* @deprecated Since 2.5 Use {@link #isEmpty(SerializerProvider, Object)} instead;
* will be removed from 2.9
*/
@Deprecated
public boolean isEmpty(T value) {
return isEmpty(null, value);
}
/**
* Method called to check whether given serializable value is
* considered "empty" value (for purposes of suppressing serialization
* of empty values).
*<p>
* Default implementation will consider only null values to be empty.
*<p>
* NOTE: replaces {@link #isEmpty(Object)}, which was deprecated in 2.5
*
* @since 2.5
*/
public boolean isEmpty(SerializerProvider provider, T value) {
return (value == null);
}
/**
* Method that can be called to see whether this serializer instance
* will use Object Id to handle cyclic references.
*/
public boolean usesObjectId() {
return false;
}
/**
* Accessor for checking whether this serializer is an
* "unwrapping" serializer; this is necessary to know since
* it may also require caller to suppress writing of the
* leading property name.
*/
public boolean isUnwrappingSerializer() {
return false;
}
/**
* Accessor that can be used to determine if this serializer uses
* another serializer for actual serialization, by
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.util;
/**
* Simple tag interface mostly to allow sorting by name.
*/
public interface Named {
public String getName();
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.*;
import com.fasterxml.jackson.databind.JavaType;
/**
* Object that represents method parameters, mostly so that associated
* annotations can be processed conveniently. Note that many of accessors
* can not return meaningful values since parameters do not have stand-alone
* JDK objects associated; so access should mostly be limited to checking
* annotation values which are properly aggregated and included.
*/
public final class AnnotatedParameter
extends AnnotatedMember
{
private static final long serialVersionUID = 1L;
/**
* Member (method, constructor) that this parameter belongs to
*/
protected final AnnotatedWithParams _owner;
/**
* JDK type of the parameter, possibly contains generic type information
*/
protected final JavaType _type;
/**
* Index of the parameter within argument list
*/
protected final int _index;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
public AnnotatedParameter(AnnotatedWithParams owner, JavaType type,
AnnotationMap annotations, int index)
{
super((owner == null) ? null : owner.getTypeContext(), annotations);
_owner = owner;
_type = type;
_index = index;
}
@Override
public AnnotatedParameter withAnnotations(AnnotationMap ann) {
if (ann == _annotations) {
return this;
}
return _owner.replaceParameterAnnotations(_index, ann);
}
/*
/**********************************************************
/* Annotated impl
/**********************************************************
*/
/**
* Since there is no matching JDK element, this method will
* always return null
*/
@Override
public AnnotatedElement getAnnotated() { return null; }
/**
* Returns modifiers of the constructor, as parameters do not
* have independent modifiers.
*/
@Override
public int getModifiers() { return _owner.getModifiers(); }
/**
* Parameters have no names in bytecode (unlike in source code),
* will always return empty String ("").
*/
@Override
public String getName() { return ""; }
@Override
public Class<?> getRawType() {
return _type.getRawClass();
}
@Override
public JavaType getType() {
return _type;
}
@Deprecated
@Override
public Type
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> getGenericType() {
return _owner.getGenericParameterType(_index);
}
/*
/**********************************************************
/* AnnotatedMember extras
/**********************************************************
*/
@Override
public Class<?> getDeclaringClass() {
return _owner.getDeclaringClass();
}
@Override
public Member getMember() {
/* This is bit tricky: since there is no JDK equivalent; can either
* return null or owner... let's do latter, for now.
*/
return _owner.getMember();
}
@Override
public void setValue(Object pojo, Object value) throws UnsupportedOperationException
{
throw new UnsupportedOperationException("Cannot call setValue() on constructor parameter of "
+getDeclaringClass().getName());
}
@Override
public Object getValue(Object pojo) throws UnsupportedOperationException
{
throw new UnsupportedOperationException("Cannot call getValue() on constructor parameter of "
+getDeclaringClass().getName());
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
public Type getParameterType() { return _type; }
/**
* Accessor for 'owner' of this parameter; method or constructor that
* has this parameter as member of its argument list.
*
* @return Owner (member or creator) object of this parameter
*/
public AnnotatedWithParams getOwner() { return _owner; }
/**
* Accessor for index of this parameter within argument list
*
* @return Index of this parameter within argument list
*/
public int getIndex() { return _index; }
/*
/********************************************************
/* Other
/********************************************************
*/
@Override
public int hashCode() {
return _owner.hashCode() + _index;
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
AnnotatedParameter other = (AnnotatedParameter) o;
return other._owner.equals(_owner) && (other._index == _index);
}
@Override
public String toString() {
return "[parameter #"+getIndex()+", annotations: "+_annotations+"]";
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> new CollectionDeserializer(_collectionType,
(JsonDeserializer<Object>) vd, vtd,
_valueInstantiator, (JsonDeserializer<Object>) dd, unwrapSingle);
}
/**
* @deprecated Since 2.7 as it does not pass `unwrapSingle`
*/
@Deprecated // since 2.7 -- will not retain "unwrapSingle" setting
protected CollectionDeserializer withResolved(JsonDeserializer<?> dd,
JsonDeserializer<?> vd, TypeDeserializer vtd)
{
return withResolved(dd, vd, vtd, _unwrapSingle);
}
// Important: do NOT cache if polymorphic values
@Override // since 2.5
public boolean isCachable() {
// 26-Mar-2015, tatu: As per [databind#735], need to be careful
return (_valueDeserializer == null)
&& (_valueTypeDeserializer == null)
&& (_delegateDeserializer == null)
;
}
/*
/**********************************************************
/* Validation, post-processing (ResolvableDeserializer)
/**********************************************************
*/
/**
* Method called to finalize setup of this deserializer,
* when it is known for which property deserializer is needed
* for.
*/
@Override
public CollectionDeserializer createContextual(DeserializationContext ctxt,
BeanProperty property) throws JsonMappingException
{
// May need to resolve types for delegate-based creators:
JsonDeserializer<Object> delegateDeser = null;
if (_valueInstantiator != null) {
if (_valueInstantiator.canCreateUsingDelegate()) {
JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid delegate-creator definition for "+_collectionType
+": value instantiator ("+_valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'");
}
delegateDeser = findDeserializer(ctxt, delegateType, property);
} else if (_valueInstantiator.canCreateUsingArrayDelegate()) {
JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig());
if (delegateType == null) {
throw new IllegalArgumentException("Invalid array-delegate-creator definition for "+_collectionType
+": value instantiator ("+_
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>valueInstantiator.getClass().getName()
+") returned true for 'canCreateUsingArrayDelegate()', but null for 'getArrayDelegateType()'");
}
delegateDeser = findDeserializer(ctxt, delegateType, property);
}
}
// [databind#1043]: allow per-property allow-wrapping of single overrides:
// 11-Dec-2015, tatu: Should we pass basic `Collection.class`, or more refined? Mostly
// comes down to "List vs Collection" I suppose... for now, pass Collection
Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class,
JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
// also, often value deserializer is resolved here:
JsonDeserializer<?> valueDeser = _valueDeserializer;
// May have a content converter
valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser);
final JavaType vt = _collectionType.getContentType();
if (valueDeser == null) {
valueDeser = ctxt.findContextualValueDeserializer(vt, property);
} else { // if directly assigned, probably not yet contextual, so:
valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, vt);
}
// and finally, type deserializer needs context as well
TypeDeserializer valueTypeDeser = _valueTypeDeserializer;
if (valueTypeDeser != null) {
valueTypeDeser = valueTypeDeser.forProperty(property);
}
return withResolved(delegateDeser, valueDeser, valueTypeDeser, unwrapSingle);
}
/*
/**********************************************************
/* ContainerDeserializerBase API
/**********************************************************
*/
@Override
public JavaType getContentType() {
return _collectionType.getContentType();
}
@Override
public JsonDeserializer<Object> getContentDeserializer() {
return _valueDeserializer;
}
/*
/**********************************************************
/* JsonDeserializer API
/**********************************************************
*/
@SuppressWarnings("unchecked")
@Override
public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
if (_delegateDeserializer != null) {
return (Collection<Object>) _valueInstantiator.createUsingDelegate(ctxt,
_delegateDeserializer.deserialize(p, ctxt
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> }
}
//System.err.println(" add '"+key+" at #"+(ix>>1)+"/"+size+" (hashed at "+slot+")");
hashed[ix] = key;
hashed[ix+1] = prop;
}
/*
for (int i = 0; i < hashed.length; i += 2) {
System.err.printf("#%02d: %s\n", i>>1, (hashed[i] == null) ? "-" : hashed[i]);
}
*/
_hashArea = hashed;
_spillCount = spillCount;
}
private final static int findSize(int size)
{
if (size <= 5) {
return 8;
}
if (size <= 12) {
return 16;
}
int needed = size + (size >> 2); // at most 80% full
int result = 32;
while (result < needed) {
result += result;
}
return result;
}
/**
* @since 2.6
*/
public static BeanPropertyMap construct(Collection<SettableBeanProperty> props, boolean caseInsensitive) {
return new BeanPropertyMap(caseInsensitive, props);
}
/**
* Fluent copy method that creates a new instance that is a copy
* of this instance except for one additional property that is
* passed as the argument.
* Note that method does not modify this instance but constructs
* and returns a new one.
*/
public BeanPropertyMap withProperty(SettableBeanProperty newProp)
{
// First: may be able to just replace?
String key = getPropertyName(newProp);
for (int i = 1, end = _hashArea.length; i < end; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i];
if ((prop != null) && prop.getName().equals(key)) {
_hashArea[i] = newProp;
_propsInOrder[_findFromOrdered(prop)] = newProp;
return this;
}
}
// If not, append
final int slot = _hashCode(key);
final int hashSize = _hashMask+1;
int ix =
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>SettableBeanProperty>(len);
for (int i = 0; i < len; ++i) {
SettableBeanProperty prop = _propsInOrder[i];
// What to do with holes? For now, retain
if (prop == null) {
newProps.add(prop);
continue;
}
newProps.add(_rename(prop, transformer));
}
// should we try to re-index? Ordering probably changed but caller probably doesn't want changes...
return new BeanPropertyMap(_caseInsensitive, newProps);
}
/**
* Mutant factory method that will use this instance as the base, and
* construct an instance that is otherwise same except for excluding
* properties with specified names.
*
* @since 2.8
*/
public BeanPropertyMap withoutProperties(Collection<String> toExclude)
{
if (toExclude.isEmpty()) {
return this;
}
final int len = _propsInOrder.length;
ArrayList<SettableBeanProperty> newProps = new ArrayList<SettableBeanProperty>(len);
for (int i = 0; i < len; ++i) {
SettableBeanProperty prop = _propsInOrder[i];
// 01-May-2015, tatu: Not 100% sure if existing `null`s should be retained;
// or, if entries to ignore should be retained as nulls. For now just
// prune them out
if (prop != null) { // may contain holes, too, check.
if (!toExclude.contains(prop.getName())) {
newProps.add(prop);
}
}
}
// should we try to re-index? Apparently no need
return new BeanPropertyMap(_caseInsensitive, newProps);
}
/**
* Specialized method that can be used to replace an existing entry
* (note: entry MUST exist; otherwise exception is thrown) with
* specified replacement.
*/
public void replace(SettableBeanProperty newProp)
{
String key = getPropertyName(newProp);
int ix = _findIndexInHash(key);
if (ix >= 0) {
SettableBeanProperty prop = (SettableBeanProperty) _hashArea[ix];
_hashArea[ix] =
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> newProp;
// also, replace in in-order
_propsInOrder[_findFromOrdered(prop)] = newProp;
return;
}
throw new NoSuchElementException("No entry '"+key+"' found, can't replace");
}
private List<SettableBeanProperty> properties() {
ArrayList<SettableBeanProperty> p = new ArrayList<SettableBeanProperty>(_size);
for (int i = 1, end = _hashArea.length; i < end; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i];
if (prop != null) {
p.add(prop);
}
}
return p;
}
/**
* Accessor for traversing over all contained properties.
*/
@Override
public Iterator<SettableBeanProperty> iterator() {
return properties().iterator();
}
/**
* Method that will re-create initial insertion-ordering of
* properties contained in this map. Note that if properties
* have been removed, array may contain nulls; otherwise
* it should be consecutive.
*
* @since 2.1
*/
public SettableBeanProperty[] getPropertiesInInsertionOrder() {
return _propsInOrder;
}
// Confining this case insensitivity to this function (and the find method) in case we want to
// apply a particular locale to the lower case function. For now, using the default.
protected final String getPropertyName(SettableBeanProperty prop) {
return _caseInsensitive ? prop.getName().toLowerCase() : prop.getName();
}
/**
* @since 2.3
*/
public SettableBeanProperty find(int index)
{
// note: will scan the whole area, including primary, secondary and
// possible spill-area
for (int i = 1, end = _hashArea.length; i < end; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i];
if ((prop != null) && (index == prop.getPropertyIndex())) {
return prop;
}
}
return null;
}
public SettableBeanProperty find(String key)
{
if (key == null) {
throw new IllegalArgumentException("Can not pass null
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (prop == null) {
continue;
}
if (!found) {
// 09-Jan-2017, tatu: Important: must check name slot and NOT property name,
// as only former is lower-case in case-insensitive case
found = key.equals(_hashArea[i-1]);
if (found) {
// need to leave a hole here
_propsInOrder[_findFromOrdered(prop)] = null;
continue;
}
}
props.add(prop);
}
if (!found) {
throw new NoSuchElementException("No entry '"+propToRm.getName()+"' found, can't remove");
}
init(props);
}
/**
* Convenience method that tries to find property with given name, and
* if it is found, call {@link SettableBeanProperty#deserializeAndSet}
* on it, and return true; or, if not found, return false.
* Note, too, that if deserialization is attempted, possible exceptions
* are wrapped if and as necessary, so caller need not handle those.
*
* @since 2.5
*/
public boolean findDeserializeAndSet(JsonParser p, DeserializationContext ctxt,
Object bean, String key) throws IOException
{
final SettableBeanProperty prop = find(key);
if (prop == null) {
return false;
}
try {
prop.deserializeAndSet(p, ctxt, bean);
} catch (Exception e) {
wrapAndThrow(e, bean, key, ctxt);
}
return true;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("Properties=[");
int count = 0;
Iterator<SettableBeanProperty> it = iterator();
while (it.hasNext()) {
SettableBeanProperty prop = it.next();
if (count++ > 0) {
sb.append(", ");
}
sb.append(prop.getName());
sb.append('(');
sb.append(prop.getType());
sb.append(')');
}
sb.append(']');
return sb.toString();
}
/*
/**********************************************************
/* Helper methods
/**********************************************************
*/
protected SettableBeanProperty _rename(SettableBeanProperty
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> prop, NameTransformer xf)
{
if (prop == null) {
return prop;
}
String newName = xf.transform(prop.getName());
prop = prop.withSimpleName(newName);
JsonDeserializer<?> deser = prop.getValueDeserializer();
if (deser != null) {
@SuppressWarnings("unchecked")
JsonDeserializer<Object> newDeser = (JsonDeserializer<Object>)
deser.unwrappingDeserializer(xf);
if (newDeser != deser) {
prop = prop.withValueDeserializer(newDeser);
}
}
return prop;
}
protected void wrapAndThrow(Throwable t, Object bean, String fieldName, DeserializationContext ctxt)
throws IOException
{
// inlined 'throwOrReturnThrowable'
while (t instanceof InvocationTargetException && t.getCause() != null) {
t = t.getCause();
}
// Errors to be passed as is
if (t instanceof Error) {
throw (Error) t;
}
// StackOverflowErrors are tricky ones; need to be careful...
boolean wrap = (ctxt == null) || ctxt.isEnabled(DeserializationFeature.WRAP_EXCEPTIONS);
// Ditto for IOExceptions; except we may want to wrap JSON exceptions
if (t instanceof IOException) {
if (!wrap || !(t instanceof JsonProcessingException)) {
throw (IOException) t;
}
} else if (!wrap) { // allow disabling wrapping for unchecked exceptions
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
}
}
throw JsonMappingException.wrapWithPath(t, bean, fieldName);
}
/**
* Helper method used to find exact location of a property with name
* given exactly, not subject to case changes, within hash area.
* Expectation is that such property SHOULD exist, although no
* exception is thrown.
*
* @since 2.7
*/
private final int _findIndexInHash(String key)
{
final int slot = _hashCode(key);
int ix = (slot<<1);
// primary match?
if (key.equals(_hashArea[ix])) {
return ix+1;
}
// no? secondary?
int hashSize = _hashMask+1;
ix = hashSize + (slot>>1) << 1;
if
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> (key.equals(_hashArea[ix])) {
return ix+1;
}
// perhaps spill then
int i = (hashSize + (hashSize>>1)) << 1;
for (int end = i + _spillCount; i < end; i += 2) {
if (key.equals(_hashArea[i])) {
return i+1;
}
}
return -1;
}
private final int _findFromOrdered(SettableBeanProperty prop) {
for (int i = 0, end = _propsInOrder.length; i < end; ++i) {
if (_propsInOrder[i] == prop) {
return i;
}
}
throw new IllegalStateException("Illegal state: property '"+prop.getName()+"' missing from _propsInOrder");
}
// Offlined version for convenience if we want to change hashing scheme
private final int _hashCode(String key) {
// This method produces better hash, fewer collisions... yet for some
// reason produces slightly worse performance. Very strange.
// 05-Aug-2015, tatu: ... still true?
/*
int h = key.hashCode();
return (h + (h >> 13)) & _hashMask;
*/
return key.hashCode() & _hashMask;
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>CREATOR_PARAM_NAME = new PropertyName("@JsonUnwrapped");
/* We do some defaulting for abstract Map classes and
* interfaces, to avoid having to use exact types or annotations in
* cases where the most common concrete Maps will do.
*/
@SuppressWarnings("rawtypes")
final static HashMap<String, Class<? extends Map>> _mapFallbacks =
new HashMap<String, Class<? extends Map>>();
static {
_mapFallbacks.put(Map.class.getName(), LinkedHashMap.class);
_mapFallbacks.put(ConcurrentMap.class.getName(), ConcurrentHashMap.class);
_mapFallbacks.put(SortedMap.class.getName(), TreeMap.class);
_mapFallbacks.put(java.util.NavigableMap.class.getName(), TreeMap.class);
_mapFallbacks.put(java.util.concurrent.ConcurrentNavigableMap.class.getName(),
java.util.concurrent.ConcurrentSkipListMap.class);
}
/* We do some defaulting for abstract Collection classes and
* interfaces, to avoid having to use exact types or annotations in
* cases where the most common concrete Collection will do.
*/
@SuppressWarnings("rawtypes")
final static HashMap<String, Class<? extends Collection>> _collectionFallbacks =
new HashMap<String, Class<? extends Collection>>();
static {
_collectionFallbacks.put(Collection.class.getName(), ArrayList.class);
_collectionFallbacks.put(List.class.getName(), ArrayList.class);
_collectionFallbacks.put(Set.class.getName(), HashSet.class);
_collectionFallbacks.put(SortedSet.class.getName(), TreeSet.class);
_collectionFallbacks.put(Queue.class.getName(), LinkedList.class);
// then JDK 1.6 types:
/* 17-May-2013, tatu: [databind#216] Should be fine to use straight Class references EXCEPT
* that some god-forsaken platforms (... looking at you, Android) do not
* include these. So, use "soft" references...
*/
_collectionFallbacks.put("java.util.Deque", LinkedList.class);
_collectionFallbacks.put("java.util.NavigableSet", TreeSet.class);
}
/*
/**********************************************************
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (instDef != null) {
instantiator = _valueInstantiatorInstance(config, ac, instDef);
}
if (instantiator == null) {
/* Second: see if some of standard Jackson/JDK types might provide value
* instantiators.
*/
instantiator = _findStdValueInstantiator(config, beanDesc);
if (instantiator == null) {
instantiator = _constructDefaultValueInstantiator(ctxt, beanDesc);
}
}
// finally: anyone want to modify ValueInstantiator?
if (_factoryConfig.hasValueInstantiators()) {
for (ValueInstantiators insts : _factoryConfig.valueInstantiators()) {
instantiator = insts.findValueInstantiator(config, beanDesc, instantiator);
// let's do sanity check; easier to spot buggy handlers
if (instantiator == null) {
ctxt.reportMappingException(
"Broken registered ValueInstantiators (of type %s): returned null ValueInstantiator",
insts.getClass().getName());
}
}
}
// Sanity check: does the chosen instantatior have incomplete creators?
if (instantiator.getIncompleteParameter() != null) {
final AnnotatedParameter nonAnnotatedParam = instantiator.getIncompleteParameter();
final AnnotatedWithParams ctor = nonAnnotatedParam.getOwner();
throw new IllegalArgumentException("Argument #"+nonAnnotatedParam.getIndex()+" of constructor "+ctor+" has no property name annotation; must have name when multiple-parameter constructor annotated as Creator");
}
return instantiator;
}
private ValueInstantiator _findStdValueInstantiator(DeserializationConfig config,
BeanDescription beanDesc)
throws JsonMappingException
{
if (beanDesc.getBeanClass() == JsonLocation.class) {
return new JsonLocationInstantiator();
}
return null;
}
/**
* Method that will construct standard default {@link ValueInstantiator}
* using annotations (like @JsonCreator) and visibility rules
*/
protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationContext ctxt,
BeanDescription beanDesc)
throws JsonMappingException
{
CreatorCollector creators = new CreatorCollector(beanDesc, ctxt.getConfig());
AnnotationIntrospector intr = ctxt.getAnnotationIntrospector();
// need to construct suitable visibility checker:
final DeserializationConfig config =
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> null) {
throw new IllegalStateException("Conflict: parameter #"+index+" of "+owner
+" bound to more than one property; "+defs[index]+" vs "+propDef);
}
}
defs[index] = propDef;
}
}
return result;
}
public ValueInstantiator _valueInstantiatorInstance(DeserializationConfig config,
Annotated annotated, Object instDef)
throws JsonMappingException
{
if (instDef == null) {
return null;
}
ValueInstantiator inst;
if (instDef instanceof ValueInstantiator) {
return (ValueInstantiator) instDef;
}
if (!(instDef instanceof Class)) {
throw new IllegalStateException("AnnotationIntrospector returned key deserializer definition of type "
+instDef.getClass().getName()
+"; expected type KeyDeserializer or Class<KeyDeserializer> instead");
}
Class<?> instClass = (Class<?>)instDef;
if (ClassUtil.isBogusClass(instClass)) {
return null;
}
if (!ValueInstantiator.class.isAssignableFrom(instClass)) {
throw new IllegalStateException("AnnotationIntrospector returned Class "+instClass.getName()
+"; expected Class<ValueInstantiator>");
}
HandlerInstantiator hi = config.getHandlerInstantiator();
if (hi != null) {
inst = hi.valueInstantiatorInstance(config, annotated, instClass);
if (inst != null) {
return inst;
}
}
return (ValueInstantiator) ClassUtil.createInstance(instClass,
config.canOverrideAccessModifiers());
}
protected void _addDeserializerConstructors
(DeserializationContext ctxt, BeanDescription beanDesc, VisibilityChecker<?> vchecker,
AnnotationIntrospector intr, CreatorCollector creators,
Map<AnnotatedWithParams,BeanPropertyDefinition[]> creatorParams)
throws JsonMappingException
{
// First things first: the "default constructor" (zero-arg
// constructor; whether implicit or explicit) is NOT included
// in list of constructors, so needs to be handled separately.
AnnotatedConstructor defaultCtor = beanDesc.findDefaultConstructor();
if (defaultCtor != null) {
if (!creators.hasDefaultCreator() || intr.hasCreatorAnnotation(defaultCtor)) {
creators.setDefaultCreator(defaultCtor);
}
}
// 25
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> true;
}
if (mode == JsonCreator.Mode.DELEGATING) {
return false;
}
// If explicit name, or inject id, property-based
if (((propDef != null) && propDef.isExplicitlyNamed())
|| (intr.findInjectableValueId(creator.getParameter(0)) != null)) {
return true;
}
if (propDef != null) {
// One more thing: if implicit name matches property with a getter
// or field, we'll consider it property-based as well
String implName = propDef.getName();
if (implName != null && !implName.isEmpty()) {
if (propDef.couldSerialize()) {
return true;
}
}
}
// in absence of everything else, default to delegating
return false;
}
protected boolean _handleSingleArgumentConstructor(DeserializationContext ctxt,
BeanDescription beanDesc, VisibilityChecker<?> vchecker,
AnnotationIntrospector intr, CreatorCollector creators,
AnnotatedConstructor ctor, boolean isCreator, boolean isVisible)
throws JsonMappingException
{
// otherwise either 'simple' number, String, or general delegate:
Class<?> type = ctor.getRawParameterType(0);
if (type == String.class || type == CharSequence.class) {
if (isCreator || isVisible) {
creators.addStringCreator(ctor, isCreator);
}
return true;
}
if (type == int.class || type == Integer.class) {
if (isCreator || isVisible) {
creators.addIntCreator(ctor, isCreator);
}
return true;
}
if (type == long.class || type == Long.class) {
if (isCreator || isVisible) {
creators.addLongCreator(ctor, isCreator);
}
return true;
}
if (type == double.class || type == Double.class) {
if (isCreator || isVisible) {
creators.addDoubleCreator(ctor, isCreator);
}
return true;
}
if (type == boolean.class || type == Boolean.class) {
if (isCreator || isVisible) {
creators.addBooleanCreator(ctor, isCreator);
}
return true;
}
// Delegating Creator ok iff it
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> of natural/native types:
deser = new StringCollectionDeserializer(type, contentDeser, inst);
} else {
deser = new CollectionDeserializer(type, contentDeser, contentTypeDeser, inst);
}
}
}
// allow post-processing it too
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
deser = mod.modifyCollectionDeserializer(config, type, beanDesc, deser);
}
}
return deser;
}
protected CollectionType _mapAbstractCollectionType(JavaType type, DeserializationConfig config)
{
Class<?> collectionClass = type.getRawClass();
collectionClass = _collectionFallbacks.get(collectionClass.getName());
if (collectionClass == null) {
return null;
}
return (CollectionType) config.constructSpecializedType(type, collectionClass);
}
// Copied almost verbatim from "createCollectionDeserializer" -- should try to share more code
@Override
public JsonDeserializer<?> createCollectionLikeDeserializer(DeserializationContext ctxt,
CollectionLikeType type, final BeanDescription beanDesc)
throws JsonMappingException
{
JavaType contentType = type.getContentType();
// Very first thing: is deserializer hard-coded for elements?
JsonDeserializer<Object> contentDeser = contentType.getValueHandler();
final DeserializationConfig config = ctxt.getConfig();
// Then optional type info (1.5): if type has been resolved, we may already know type deserializer:
TypeDeserializer contentTypeDeser = contentType.getTypeHandler();
// but if not, may still be possible to find:
if (contentTypeDeser == null) {
contentTypeDeser = findTypeDeserializer(config, contentType);
}
JsonDeserializer<?> deser = _findCustomCollectionLikeDeserializer(type, config, beanDesc,
contentTypeDeser, contentDeser);
if (deser != null) {
// and then new with 2.2: ability to post-process it too (Issue#120)
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
deser = mod.modifyCollectionLikeDeserializer(config, type, beanDesc, deser);
}
}
}
return deser;
}
/*
/**********************************************************
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>type.isInterface() || type.isAbstract()) {
@SuppressWarnings("rawtypes")
Class<? extends Map> fallback = _mapFallbacks.get(mapClass.getName());
if (fallback != null) {
mapClass = fallback;
type = (MapType) config.constructSpecializedType(type, mapClass);
// But if so, also need to re-check creators...
beanDesc = config.introspectForCreation(type);
} else {
// [databind#292]: Actually, may be fine, but only if polymorphic deser enabled
if (type.getTypeHandler() == null) {
throw new IllegalArgumentException("Can not find a deserializer for non-concrete Map type "+type);
}
deser = AbstractDeserializer.constructForNonPOJO(beanDesc);
}
}
if (deser == null) {
ValueInstantiator inst = findValueInstantiator(ctxt, beanDesc);
// 01-May-2016, tatu: Which base type to use here gets tricky, since
// most often it ought to be `Map` or `EnumMap`, but due to abstract
// mapping it will more likely be concrete type like `HashMap`.
// So, for time being, just pass `Map.class`
MapDeserializer md = new MapDeserializer(type, inst, keyDes, contentDeser, contentTypeDeser);
JsonIgnoreProperties.Value ignorals = config.getDefaultPropertyIgnorals(Map.class,
beanDesc.getClassInfo());
Set<String> ignored = (ignorals == null) ? null
: ignorals.findIgnoredForDeserialization();
md.setIgnorableProperties(ignored);
deser = md;
}
}
}
if (_factoryConfig.hasDeserializerModifiers()) {
for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
deser = mod.modifyMapDeserializer(config, type, beanDesc, deser);
}
}
return deser;
}
// Copied almost verbatim from "createMapDeserializer" -- should try to share more code
@Override
public JsonDeserializer<?> createMapLikeDeserializer(DeserializationContext ctxt,
MapLikeType type, final BeanDescription beanDesc)
throws JsonMappingException
{
JavaType keyType = type.getKeyType();
Java
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Creator (for Enum type "
+enumClass.getName()+")");
}
}
// Also, need to consider @JsonValue, if one found
return StdKeyDeserializers.constructEnumKeyDeserializer(enumRes);
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Method called to create a type information deserializer for values of
* given non-container property, if one is needed.
* If not needed (no polymorphic handling configured for property), should return null.
*<p>
* Note that this method is only called for non-container bean properties,
* and not for values in container types or root values (or container properties)
*
* @param baseType Declared base type of the value to deserializer (actual
* deserializer type will be this type or its subtype)
*
* @return Type deserializer to use for given base type, if one is needed; null if not.
*/
public TypeDeserializer findPropertyTypeDeserializer(DeserializationConfig config,
JavaType baseType, AnnotatedMember annotated)
throws JsonMappingException
{
AnnotationIntrospector ai = config.getAnnotationIntrospector();
TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, annotated, baseType);
// Defaulting: if no annotations on member, check value class
if (b == null) {
return findTypeDeserializer(config, baseType);
}
// but if annotations found, may need to resolve subtypes:
Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByTypeId(
config, annotated, baseType);
return b.buildTypeDeserializer(config, baseType, subtypes);
}
/**
* Method called to find and create a type information deserializer for values of
* given container (list, array, map) property, if one is needed.
* If not needed (no polymorphic handling configured for property), should return null.
*<p>
* Note that this method is only called for container bean properties,
* and not for values in container types or root values (or non-container properties)
*
* @param containerType Type of property; must be a container type
* @param propertyEntity Field or method that contains container property
*/
public TypeDeserializer findPropertyContentTypeDeserializer(DeserializationConfig config
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> 1) ? TypeFactory.unknownType() : tps[0];
CollectionType ct = tf.constructCollectionType(Collection.class, elemType);
// Should we re-introspect beanDesc? For now let's not...
return createCollectionDeserializer(ctxt, ct, beanDesc);
}
if (rawType == CLASS_MAP_ENTRY) {
// 28-Apr-2015, tatu: TypeFactory does it all for us already so
JavaType kt = type.containedType(0);
if (kt == null) {
kt = TypeFactory.unknownType();
}
JavaType vt = type.containedType(1);
if (vt == null) {
vt = TypeFactory.unknownType();
}
TypeDeserializer vts = (TypeDeserializer) vt.getTypeHandler();
if (vts == null) {
vts = findTypeDeserializer(ctxt.getConfig(), vt);
}
JsonDeserializer<Object> valueDeser = vt.getValueHandler();
KeyDeserializer keyDes = (KeyDeserializer) kt.getValueHandler();
return new MapEntryDeserializer(type, keyDes, valueDeser, vts);
}
String clsName = rawType.getName();
if (rawType.isPrimitive() || clsName.startsWith("java.")) {
// Primitives/wrappers, other Numbers:
JsonDeserializer<?> deser = NumberDeserializers.find(rawType, clsName);
if (deser == null) {
deser = DateDeserializers.find(rawType, clsName);
}
if (deser != null) {
return deser;
}
}
// and a few Jackson types as well:
if (rawType == TokenBuffer.class) {
return new TokenBufferDeserializer();
}
JsonDeserializer<?> deser = findOptionalStdDeserializer(ctxt, type, beanDesc);
if (deser != null) {
return deser;
}
return JdkDeserializers.find(rawType, clsName);
}
protected JavaType _findRemappedType(DeserializationConfig config, Class<?> rawType) throws JsonMappingException {
JavaType type = mapAbstractType(config, config.constructType(rawType));
return (type == null || type.hasRawClass(rawType)) ? null : type;
}
/*
/********************************************************
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.util.Iterator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.util.ClassUtil;
import com.fasterxml.jackson.databind.util.Named;
/**
* Simple value classes that contain definitions of properties,
* used during introspection of properties to use for
* serialization and deserialization purposes.
* These instances are created before actual {@link BeanProperty}
* instances are created, i.e. they are used earlier in the process
* flow, and are typically use to construct actual
* {@link BeanProperty} instances.
*/
public abstract class BeanPropertyDefinition
implements Named
{
protected final static JsonInclude.Value EMPTY_INCLUDE = JsonInclude.Value.empty();
/*
/**********************************************************
/* Fluent factory methods for creating modified copies
/**********************************************************
*/
/**
* Method that can be used to create a definition with
* same settings as this one, but with different
* (external) name; that is, one for which
* {@link #getName()} would return <code>newName</code>.
*
* @since 2.3
*/
public abstract BeanPropertyDefinition withName(PropertyName newName);
/**
* Alternate "mutant factory" that will only change simple name, but
* leave other optional parts (like namespace) as is.
*
* @since 2.3
*/
public abstract BeanPropertyDefinition withSimpleName(String newSimpleName);
/*
/**********************************************************
/* Basic property information, name, type
/**********************************************************
*/
/**
* Accessor for name used for external representation (in JSON).
*/
@Override // from Named
public abstract String getName();
public abstract PropertyName getFullName();
/**
* @since 2.6
*/
public boolean hasName(PropertyName name) {
return getFullName().equals(name);
}
/**
* Accessor that can be used to determine implicit name from underlying
* element(s) before possible renaming. This is the "internal"
* name derived from accessor ("x" from "getX"), and is not based on
* annotations or naming strategy.
*/
public abstract String getInternalName();
/**
* Access
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> // [databind#631]
_serializeWithObjectId(bean, gen, provider, true);
return;
}
gen.writeStartObject(bean);
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, gen, provider);
} else {
serializeFields(bean, gen, provider);
}
gen.writeEndObject();
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override public String toString() {
return "BeanSerializer for "+handledType().getName();
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> curr._parent) {
sb.append(' ').append(curr._current.getName());
}
sb.append(']');
return sb.toString();
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>, handledType(), propName);
continue;
}
// "any property"?
if (_anySetter != null) {
try {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
}
continue;
}
// Ok then, let's collect the whole field; name and value
if (unknown == null) {
unknown = new TokenBuffer(p, ctxt);
}
unknown.writeFieldName(propName);
unknown.copyCurrentStructure(p);
}
// We hit END_OBJECT, so:
Object bean;
try {
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
wrapInstantiationProblem(e, ctxt);
bean = null; // never gets here
}
if (referrings != null) {
for (BeanReferring referring : referrings) {
referring.setBean(bean);
}
}
if (unknown != null) {
// polymorphic?
if (bean.getClass() != _beanType.getRawClass()) {
return handlePolymorphic(null, ctxt, bean, unknown);
}
// no, just some extra unknown properties
return handleUnknownProperties(ctxt, bean, unknown);
}
return bean;
}
/**
* @since 2.8
*/
private BeanReferring handleUnresolvedReference(DeserializationContext ctxt,
SettableBeanProperty prop, PropertyValueBuffer buffer,
UnresolvedForwardReference reference)
throws JsonMappingException
{
BeanReferring referring = new BeanReferring(ctxt, reference,
prop.getType(), buffer, prop);
reference.getRoid().appendReferring(referring);
return referring;
}
protected final Object _deserializeWithErrorWrapping(JsonParser p,
DeserializationContext ctxt, SettableBeanProperty prop)
throws IOException
{
try {
return prop.deserialize(p, ctxt);
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), prop.getName(), ctxt);
// never gets here, unless caller declines to throw an exception
return null;
}
}
/**
* Helper method called for rare case of
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
if (_anySetter != null) {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
}
}
// We hit END_OBJECT; resolve the pieces:
try {
return ext.complete(p, ctxt, buffer, creator);
} catch (Exception e) {
return wrapInstantiationProblem(e, ctxt);
}
}
/**
* Helper method for getting a lazily construct exception to be reported
* to {@link DeserializationContext#handleInstantiationProblem(Class, Object, Throwable)}.
*
* @since 2.8
*/
protected Exception _creatorReturnedNullException() {
if (_nullFromCreator == null) {
_nullFromCreator = new NullPointerException("JSON Creator returned null");
}
return _nullFromCreator;
}
/**
* @since 2.8
*/
static class BeanReferring extends Referring
{
private final DeserializationContext _context;
private final SettableBeanProperty _prop;
private Object _bean;
BeanReferring(DeserializationContext ctxt, UnresolvedForwardReference ref,
JavaType valueType, PropertyValueBuffer buffer, SettableBeanProperty prop)
{
super(ref, valueType);
_context = ctxt;
_prop = prop;
}
public void setBean(Object bean) {
_bean = bean;
}
@Override
public void handleResolvedForwardReference(Object id, Object value) throws IOException
{
if (_bean == null) {
_context.reportMappingException(
"Can not resolve ObjectId forward reference using property '%s' (of type %s): Bean not yet resolved",
_prop.getName(), _prop.getDeclaringClass().getName());
}
_prop.set(_bean, value);
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> property or replacing a property.
*/
public void addOrReplaceProperty(SettableBeanProperty prop, boolean allowOverride) {
_properties.put(prop.getName(), prop);
}
/**
* Method to add a property setter. Will ensure that there is no
* unexpected override; if one is found will throw a
* {@link IllegalArgumentException}.
*/
public void addProperty(SettableBeanProperty prop)
{
SettableBeanProperty old = _properties.put(prop.getName(), prop);
if (old != null && old != prop) { // should never occur...
throw new IllegalArgumentException("Duplicate property '"+prop.getName()+"' for "+_beanDesc.getType());
}
}
/**
* Method called to add a property that represents so-called back reference;
* reference that "points back" to object that has forward reference to
* currently built bean.
*/
public void addBackReferenceProperty(String referenceName, SettableBeanProperty prop)
{
if (_backRefProperties == null) {
_backRefProperties = new HashMap<String, SettableBeanProperty>(4);
}
// 15-Sep-2016, tatu: For some reason fixing access at point of `build()` does
// NOT work (2 failing unit tests). Not 100% clear why, but for now force
// access set early; unfortunate, but since it works....
prop.fixAccess(_config);
_backRefProperties.put(referenceName, prop);
// also: if we had property with same name, actually remove it
if (_properties != null) {
_properties.remove(prop.getName());
}
// ??? 23-Jul-2012, tatu: Should it be included in list of all properties?
// For now, won't add, since it is inferred, not explicit...
}
public void addInjectable(PropertyName propName, JavaType propType,
Annotations contextAnnotations, AnnotatedMember member,
Object valueId)
{
if (_injectables == null) {
_injectables = new ArrayList<ValueInjector>();
}
boolean fixAccess = _config.canOverrideAccessModifiers();
boolean forceAccess = fixAccess && _config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFI
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>ValueProperty(_objectIdReader, PropertyMetadata.STD_REQUIRED);
propertyMap = propertyMap.withProperty(prop);
}
return new BeanDeserializer(this,
_beanDesc, propertyMap, _backRefProperties, _ignorableProps, _ignoreAllUnknown,
anyViews);
}
/**
* Alternate build method used when we must be using some form of
* abstract resolution, usually by using addition Type Id
* ("polymorphic deserialization")
*
* @since 2.0
*/
public AbstractDeserializer buildAbstract() {
return new AbstractDeserializer(this, _beanDesc, _backRefProperties);
}
/**
* Method for constructing a specialized deserializer that uses
* additional external Builder object during data binding.
*/
public JsonDeserializer<?> buildBuilderBased(JavaType valueType,
String expBuildMethodName)
{
// First: validation; must have build method that returns compatible type
if (_buildMethod == null) {
// as per [databind#777], allow empty name
if (!expBuildMethodName.isEmpty()) {
throw new IllegalArgumentException(String.format(
"Builder class %s does not have build method (name: '%s')",
_beanDesc.getBeanClass().getName(),
expBuildMethodName));
}
} else {
// also: type of the method must be compatible
Class<?> rawBuildType = _buildMethod.getRawReturnType();
Class<?> rawValueType = valueType.getRawClass();
if ((rawBuildType != rawValueType)
&& !rawBuildType.isAssignableFrom(rawValueType)
&& !rawValueType.isAssignableFrom(rawBuildType)) {
throw new IllegalArgumentException("Build method '"+_buildMethod.getFullName()
+" has bad return type ("+rawBuildType.getName()
+"), not compatible with POJO type ("+valueType.getRawClass().getName()+")");
}
}
// And if so, we can try building the deserializer
Collection<SettableBeanProperty> props = _properties.values();
_fixAccess(props);
BeanPropertyMap propertyMap = BeanPropertyMap.construct(props,
_config.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
propertyMap.assignIndexes();
boolean anyViews = !_config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION);
if (!any
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.*;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.util.ClassUtil;
public final class AnnotatedConstructor
extends AnnotatedWithParams
{
private static final long serialVersionUID = 1L;
protected final Constructor<?> _constructor;
/**
* Field that is used to make JDK serialization work with this
* object.
*
* @since 2.1
*/
protected Serialization _serialization;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
public AnnotatedConstructor(TypeResolutionContext ctxt, Constructor<?> constructor,
AnnotationMap classAnn, AnnotationMap[] paramAnn)
{
super(ctxt, classAnn, paramAnn);
if (constructor == null) {
throw new IllegalArgumentException("Null constructor not allowed");
}
_constructor = constructor;
}
/**
* Method used for JDK serialization support
* @since 2.1
*/
protected AnnotatedConstructor(Serialization ser)
{
super(null, null, null);
_constructor = null;
_serialization = ser;
}
@Override
public AnnotatedConstructor withAnnotations(AnnotationMap ann) {
return new AnnotatedConstructor(_typeContext, _constructor, ann, _paramAnnotations);
}
/*
/**********************************************************
/* Annotated impl
/**********************************************************
*/
@Override
public Constructor<?> getAnnotated() { return _constructor; }
@Override
public int getModifiers() { return _constructor.getModifiers(); }
@Override
public String getName() { return _constructor.getName(); }
@Override
public JavaType getType() {
return _typeContext.resolveType(getRawType());
}
@Override
public Class<?> getRawType() {
return _constructor.getDeclaringClass();
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
@Override
public int getParameterCount() {
return _constructor.getParameterTypes().length;
}
@Override
public Class<?> getRawParameterType(int index)
{
Class<?>[] types = _constructor.getParameterTypes();
return (index >= types.length) ? null : types[index];
}
@Override
public JavaType getParameterType(int index) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
Type[] types = _constructor.getGenericParameterTypes();
if (index >= types.length) {
return null;
}
return _typeContext.resolveType(types[index]);
}
@Override
@Deprecated // since 2.7
public Type getGenericParameterType(int index) {
Type[] types = _constructor.getGenericParameterTypes();
if (index >= types.length) {
return null;
}
return types[index];
}
@Override
public final Object call() throws Exception {
return _constructor.newInstance();
}
@Override
public final Object call(Object[] args) throws Exception {
return _constructor.newInstance(args);
}
@Override
public final Object call1(Object arg) throws Exception {
return _constructor.newInstance(arg);
}
/*
/**********************************************************
/* AnnotatedMember impl
/**********************************************************
*/
@Override
public Class<?> getDeclaringClass() { return _constructor.getDeclaringClass(); }
@Override
public Member getMember() { return _constructor; }
@Override
public void setValue(Object pojo, Object value)
throws UnsupportedOperationException
{
throw new UnsupportedOperationException("Cannot call setValue() on constructor of "
+getDeclaringClass().getName());
}
@Override
public Object getValue(Object pojo)
throws UnsupportedOperationException
{
throw new UnsupportedOperationException("Cannot call getValue() on constructor of "
+getDeclaringClass().getName());
}
/*
/**********************************************************
/* Extended API, specific annotations
/**********************************************************
*/
@Override
public String toString() {
return "[constructor for "+getName()+", annotations: "+_annotations+"]";
}
@Override
public int hashCode() {
return _constructor.getName().hashCode();
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (o == null || o.getClass() != getClass()) return false;
return ((AnnotatedConstructor) o)._constructor == _constructor;
}
/*
/**********************************************************
/* JDK serialization handling
/**********************************************************
*/
Object writeReplace() {
return new AnnotatedConstructor(new Serialization(_constructor));
}
Object readResolve() {
Class<?> clazz = _serialization.clazz;
try {
Constructor<?> ctor = clazz.getDeclaredConstructor(_serialization.
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>args);
// 06-Oct-2012, tatu: Has "lost" its security override, must force back
if (!ctor.isAccessible()) {
ClassUtil.checkAndFixAccess(ctor, false);
}
return new AnnotatedConstructor(null, ctor, null, null);
} catch (Exception e) {
throw new IllegalArgumentException("Could not find constructor with "
+_serialization.args.length+" args from Class '"+clazz.getName());
}
}
/**
* Helper class that is used as the workaround to persist
* Field references. It basically just stores declaring class
* and field name.
*/
private final static class Serialization
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected Class<?> clazz;
protected Class<?>[] args;
public Serialization(Constructor<?> ctor) {
clazz = ctor.getDeclaringClass();
args = ctor.getParameterTypes();
}
}
}
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Match()) {
_reportUnkownFormat(_dataFormatReaders, match);
}
JsonParser p = match.createParserWithMatch();
// One more thing: we Own the input stream now; and while it's
// not super clean way to do it, we must ensure closure so:
if (forceClosing) {
p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
}
// important: use matching ObjectReader (may not be 'this')
return match.getReader()._bindAndReadValues(p);
}
@SuppressWarnings("resource")
protected JsonNode _detectBindAndCloseAsTree(InputStream in) throws IOException
{
DataFormatReaders.Match match = _dataFormatReaders.findFormat(in);
if (!match.hasMatch()) {
_reportUnkownFormat(_dataFormatReaders, match);
}
JsonParser p = match.createParserWithMatch();
p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE);
return match.getReader()._bindAndCloseAsTree(p);
}
/**
* Method called to indicate that format detection failed to detect format
* of given input
*/
protected void _reportUnkownFormat(DataFormatReaders detector, DataFormatReaders.Match match) throws JsonProcessingException
{
// 17-Aug-2015, tatu: Unfortunately, no parser/generator available so:
throw new JsonParseException(null, "Can not detect format from input, does not look like any of detectable formats "
+detector.toString());
}
/*
/**********************************************************
/* Internal methods, other
/**********************************************************
*/
/**
* @since 2.2
*/
protected void _verifySchemaType(FormatSchema schema)
{
if (schema != null) {
if (!_parserFactory.canUseSchema(schema)) {
throw new IllegalArgumentException("Can not use FormatSchema of type "+schema.getClass().getName()
+" for format "+_parserFactory.getFormatName());
}
}
}
/**
* Internal helper method called to create an instance of {@link DeserializationContext}
* for deserializing a single root value.
* Can be overridden if a custom context is needed.
*/
protected DefaultDeserializationContext createDeserializationContext(JsonParser p) {
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
return _context.createInstance(_config, p, _injectableValues);
}
protected void _reportUndetectableSource(Object src) throws JsonProcessingException
{
// 17-Aug-2015, tatu: Unfortunately, no parser/generator available so:
throw new JsonParseException(null, "Can not use source of type "
+src.getClass().getName()+" with format auto-detection: must be byte- not char-based");
}
protected InputStream _inputStream(URL src) throws IOException {
return src.openStream();
}
protected InputStream _inputStream(File f) throws IOException {
return new FileInputStream(f);
}
/*
/**********************************************************
/* Helper methods, locating deserializers etc
/**********************************************************
*/
/**
* Method called to locate deserializer for the passed root-level value.
*/
protected JsonDeserializer<Object> _findRootDeserializer(DeserializationContext ctxt)
throws JsonMappingException
{
if (_rootDeserializer != null) {
return _rootDeserializer;
}
// Sanity check: must have actual type...
JavaType t = _valueType;
if (t == null) {
ctxt.reportMappingException("No value type configured for ObjectReader");
}
// First: have we already seen it?
JsonDeserializer<Object> deser = _rootDeserializers.get(t);
if (deser != null) {
return deser;
}
// Nope: need to ask provider to resolve it
deser = ctxt.findRootValueDeserializer(t);
if (deser == null) { // can this happen?
ctxt.reportMappingException("Can not find a deserializer for type %s", t);
}
_rootDeserializers.put(t, deser);
return deser;
}
/**
* @since 2.6
*/
protected JsonDeserializer<Object> _findTreeDeserializer(DeserializationContext ctxt)
throws JsonMappingException
{
JsonDeserializer<Object> deser = _rootDeserializers.get(JSON_NODE_TYPE);
if (deser == null) {
// Nope: need to ask provider to resolve it
deser = ctxt.findRootValueDeserializer(JSON_NODE_TYPE);
if (deser == null) { // can this happen?
ctxt.reportMappingException("Can not find
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> value serializer; but, alas, there's no access
* to serializer factory at this point...
*/
// let's cache it, may be needed soon again
ser = prov.findTypedValueSerializer(c, true, _property);
}
ser.serialize(value, gen, prov);
} catch (IOException ioe) {
throw ioe;
} catch (Exception e) {
Throwable t = e;
// Need to unwrap this specific type, to see infinite recursion...
while (t instanceof InvocationTargetException && t.getCause() != null) {
t = t.getCause();
}
// Errors shouldn't be wrapped (and often can't, as well)
if (t instanceof Error) {
throw (Error) t;
}
// let's try to indicate the path best we can...
throw JsonMappingException.wrapWithPath(t, bean, _accessorMethod.getName() + "()");
}
}
@Override
public void serializeWithType(Object bean, JsonGenerator gen, SerializerProvider provider,
TypeSerializer typeSer0) throws IOException
{
// Regardless of other parts, first need to find value to serialize:
Object value = null;
try {
value = _accessorMethod.getValue(bean);
// and if we got null, can also just write it directly
if (value == null) {
provider.defaultSerializeNull(gen);
return;
}
JsonSerializer<Object> ser = _valueSerializer;
if (ser == null) { // no serializer yet? Need to fetch
// ser = provider.findTypedValueSerializer(value.getClass(), true, _property);
ser = provider.findValueSerializer(value.getClass(), _property);
} else {
/* 09-Dec-2010, tatu: To work around natural type's refusal to add type info, we do
* this (note: type is for the wrapper type, not enclosed value!)
*/
if (_forceTypeInformation) {
typeSer0.writeTypePrefixForScalar(bean, gen);
ser.serialize(value, gen, provider);
typeSer0.writeTypeSuffixForScalar(bean, gen);
return;
}
}
// 28-Sep-2016, tatu: As per [databind#
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>1385], we do need to do some juggling
// to use different Object for type id (logical type) and actual serialization
// (delegat type).
TypeSerializerRerouter rr = new TypeSerializerRerouter(typeSer0, bean);
ser.serializeWithType(value, gen, provider, rr);
} catch (IOException ioe) {
throw ioe;
} catch (Exception e) {
Throwable t = e;
// Need to unwrap this specific type, to see infinite recursion...
while (t instanceof InvocationTargetException && t.getCause() != null) {
t = t.getCause();
}
// Errors shouldn't be wrapped (and often can't, as well)
if (t instanceof Error) {
throw (Error) t;
}
// let's try to indicate the path best we can...
throw JsonMappingException.wrapWithPath(t, bean, _accessorMethod.getName() + "()");
}
}
@SuppressWarnings("deprecation")
@Override
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
throws JsonMappingException
{
if (_valueSerializer instanceof SchemaAware) {
return ((SchemaAware)_valueSerializer).getSchema(provider, null);
}
return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode();
}
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
throws JsonMappingException
{
/* 27-Apr-2015, tatu: First things first; for JSON Schema introspection,
* Enum types that use `@JsonValue` are special (but NOT necessarily
* anything else that RETURNS an enum!)
* So we will need to add special
* handling here (see https://github.com/FasterXML/jackson-module-jsonSchema/issues/57
* for details).
*
* Note that meaning of JsonValue, then, is very different for Enums. Sigh.
*/
final JavaType type = _accessorMethod.getType();
Class<?> declaring = _accessorMethod.getDeclaringClass();
if ((declaring != null) && declaring.isEnum()) {
if (_acceptJsonFormatVisitorForEnum(visitor, typeHint, declaring)) {
return;
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
}
JsonSerializer<Object> ser = _valueSerializer;
if (ser == null) {
ser = visitor.getProvider().findTypedValueSerializer(type, false, _property);
if (ser == null) { // can this ever occur?
visitor.expectAnyFormat(typeHint);
return;
}
}
ser.acceptJsonFormatVisitor(visitor, null);
}
/**
* Overridable helper method used for special case handling of schema information for
* Enums.
*
* @return True if method handled callbacks; false if not; in latter case caller will
* send default callbacks
*
* @since 2.6
*/
protected boolean _acceptJsonFormatVisitorForEnum(JsonFormatVisitorWrapper visitor,
JavaType typeHint, Class<?> enumType)
throws JsonMappingException
{
// Copied from EnumSerializer#acceptJsonFormatVisitor
JsonStringFormatVisitor stringVisitor = visitor.expectStringFormat(typeHint);
if (stringVisitor != null) {
Set<String> enums = new LinkedHashSet<String>();
for (Object en : enumType.getEnumConstants()) {
try {
// 21-Apr-2016, tatu: This is convoluted to the max, but essentially we
// call `@JsonValue`-annotated accessor method on all Enum members,
// so it all "works out". To some degree.
enums.add(String.valueOf(_accessorMethod.callOn(en)));
} catch (Exception e) {
Throwable t = e;
while (t instanceof InvocationTargetException && t.getCause() != null) {
t = t.getCause();
}
if (t instanceof Error) {
throw (Error) t;
}
throw JsonMappingException.wrapWithPath(t, en, _accessorMethod.getName() + "()");
}
}
stringVisitor.enumTypes(enums);
}
return true;
}
protected boolean isNaturalTypeWithStdHandling(Class<?> rawType, JsonSerializer<?> ser)
{
// First: do we have a natural type being handled?
if (rawType.isPrimitive()) {
if (rawType != Integer.TYPE && rawType != Boolean.TYPE && rawType != Double.TYPE) {
return false;
}
} else {
if
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> (rawType != String.class &&
rawType != Integer.class && rawType != Boolean.class && rawType != Double.class) {
return false;
}
}
return isDefaultSerializer(ser);
}
/*
/**********************************************************
/* Other methods
/**********************************************************
*/
@Override
public String toString() {
return "(@JsonValue serializer for method " + _accessorMethod.getDeclaringClass() + "#" + _accessorMethod.getName() + ")";
}
/*
/**********************************************************
/* Helper class
/**********************************************************
*/
/**
* Silly little wrapper class we need to re-route type serialization so that we can
* override Object to use for type id (logical type) even when asking serialization
* of something else (delegate type)
*/
static class TypeSerializerRerouter
extends TypeSerializer
{
protected final TypeSerializer _typeSerializer;
protected final Object _forObject;
public TypeSerializerRerouter(TypeSerializer ts, Object ob) {
_typeSerializer = ts;
_forObject = ob;
}
@Override
public TypeSerializer forProperty(BeanProperty prop) { // should never get called
throw new UnsupportedOperationException();
}
@Override
public As getTypeInclusion() {
return _typeSerializer.getTypeInclusion();
}
@Override
public String getPropertyName() {
return _typeSerializer.getPropertyName();
}
@Override
public TypeIdResolver getTypeIdResolver() {
return _typeSerializer.getTypeIdResolver();
}
@Override
public void writeTypePrefixForScalar(Object value, JsonGenerator gen) throws IOException {
_typeSerializer.writeTypePrefixForScalar(_forObject, gen);
}
@Override
public void writeTypePrefixForObject(Object value, JsonGenerator gen) throws IOException {
_typeSerializer.writeTypePrefixForObject(_forObject, gen);
}
@Override
public void writeTypePrefixForArray(Object value, JsonGenerator gen) throws IOException {
_typeSerializer.writeTypePrefixForArray(_forObject, gen);
}
@Override
public void writeTypeSuffixForScalar(Object value, JsonGenerator gen) throws IOException {
_typeSerializer.writeTypeSuffixForScalar(_forObject, gen);
}
@Override
public void writeTypeSuffixForObject(Object value, JsonGenerator gen)
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>ValueInstantiator(DeserializationConfig config, Class<?> valueType) {
_valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.getName();
_valueClass = (valueType == null) ? Object.class : valueType;
}
public StdValueInstantiator(DeserializationConfig config, JavaType valueType) {
_valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString();
_valueClass = (valueType == null) ? Object.class : valueType.getRawClass();
}
/**
* Copy-constructor that sub-classes can use when creating new instances
* by fluent-style construction
*/
protected StdValueInstantiator(StdValueInstantiator src)
{
_valueTypeDesc = src._valueTypeDesc;
_valueClass = src._valueClass;
_defaultCreator = src._defaultCreator;
_constructorArguments = src._constructorArguments;
_withArgsCreator = src._withArgsCreator;
_delegateType = src._delegateType;
_delegateCreator = src._delegateCreator;
_delegateArguments = src._delegateArguments;
_arrayDelegateType = src._arrayDelegateType;
_arrayDelegateCreator = src._arrayDelegateCreator;
_arrayDelegateArguments = src._arrayDelegateArguments;
_fromStringCreator = src._fromStringCreator;
_fromIntCreator = src._fromIntCreator;
_fromLongCreator = src._fromLongCreator;
_fromDoubleCreator = src._fromDoubleCreator;
_fromBooleanCreator = src._fromBooleanCreator;
}
/**
* Method for setting properties related to instantiating values
* from JSON Object. We will choose basically only one approach (out of possible
* three), and clear other properties
*/
public void configureFromObjectSettings(AnnotatedWithParams defaultCreator,
AnnotatedWithParams delegateCreator, JavaType delegateType, SettableBeanProperty[] delegateArgs,
AnnotatedWithParams withArgsCreator, SettableBeanProperty[] constructorArgs)
{
_defaultCreator = defaultCreator;
_delegateCreator = delegateCreator;
_delegateType = delegateType;
_delegateArguments = delegateArgs;
_withArgsCreator = withArgsCreator;
_constructorArguments = constructorArgs;
}
public void configureFromArraySettings(
AnnotatedWithParams arrayDelegateCreator,
JavaType arrayDelegateType,
SettableBean
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.ser;
import java.lang.annotation.Annotation;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
import com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Base class for writers used to output property values (name-value pairs)
* as key/value pairs via streaming API. This is the most generic abstraction
* implemented by both POJO and {@link java.util.Map} serializers, and invoked
* by filtering functionality.
*
* @since 2.3
*/
public abstract class PropertyWriter
extends ConcreteBeanPropertyBase // since 2.7
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected PropertyWriter(PropertyMetadata md) {
super(md);
}
protected PropertyWriter(BeanPropertyDefinition propDef) {
super(propDef.getMetadata());
}
protected PropertyWriter(PropertyWriter base) {
super(base);
}
/*
/**********************************************************
/* Metadata access
/**********************************************************
*/
@Override
public abstract String getName();
@Override
public abstract PropertyName getFullName();
/**
* Convenience method for accessing annotation that may be associated
* either directly on property, or, if not, via enclosing class (context).
* This allows adding baseline contextual annotations, for example, by adding
* an annotation for a given class and making that apply to all properties
* unless overridden by per-property annotations.
*<p>
* This method is functionally equivalent to:
*<pre>
* MyAnnotation ann = propWriter.getAnnotation(MyAnnotation.class);
* if (ann == null) {
* ann = propWriter.getContextAnnotation(MyAnnotation.class);
* }
*</pre>
* that is, tries to find a property annotation first, but if one is not
* found, tries to find context-annotation (from enclosing class) of
* same type.
*
* @since 2
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>}.
* This way added methods will not break backwards compatibility of custom annotation
* introspectors.
*/
@SuppressWarnings("serial")
public abstract class AnnotationIntrospector
implements Versioned, java.io.Serializable
{
/*
/**********************************************************
/* Helper types
/**********************************************************
*/
/**
* Value type used with managed and back references; contains type and
* logic name, used to link related references
*/
public static class ReferenceProperty
{
public enum Type {
/**
* Reference property that Jackson manages and that is serialized normally (by serializing
* reference object), but is used for resolving back references during
* deserialization.
* Usually this can be defined by using
* {@link com.fasterxml.jackson.annotation.JsonManagedReference}
*/
MANAGED_REFERENCE
/**
* Reference property that Jackson manages by suppressing it during serialization,
* and reconstructing during deserialization.
* Usually this can be defined by using
* {@link com.fasterxml.jackson.annotation.JsonBackReference}
*/
,BACK_REFERENCE
;
}
private final Type _type;
private final String _name;
public ReferenceProperty(Type t, String n) {
_type = t;
_name = n;
}
public static ReferenceProperty managed(String name) { return new ReferenceProperty(Type.MANAGED_REFERENCE, name); }
public static ReferenceProperty back(String name) { return new ReferenceProperty(Type.BACK_REFERENCE, name); }
public Type getType() { return _type; }
public String getName() { return _name; }
public boolean isManagedReference() { return _type == Type.MANAGED_REFERENCE; }
public boolean isBackReference() { return _type == Type.BACK_REFERENCE; }
}
/*
/**********************************************************
/* Factory methods
/**********************************************************
*/
/**
* Factory method for accessing "no operation" implementation
* of introspector: instance that will never find any annotation-based
* configuration.
*/
public static AnnotationIntrospector nopInstance() {
return NopAnnotationIntrospector.instance;
}
public static AnnotationIntrospector pair(AnnotationIntrospector a1, AnnotationIntrospector a2) {
return new AnnotationIntrospectorPair(a1, a2);
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>Class();
try {
// 11-Oct-2015, tatu: For deser, we call `TypeFactory.constructSpecializedType()`,
// may be needed here too in future?
if (serClass.isAssignableFrom(currRaw)) { // common case
type = tf.constructGeneralizedType(type, serClass);
} else if (currRaw.isAssignableFrom(serClass)) { // specialization, ok as well
type = tf.constructSpecializedType(type, serClass);
} else {
throw new JsonMappingException(null,
String.format("Can not refine serialization type %s into %s; types not related",
type, serClass.getName()));
}
} catch (IllegalArgumentException iae) {
throw new JsonMappingException(null,
String.format("Failed to widen type %s with annotation (value %s), from '%s': %s",
type, serClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
}
// Then further processing for container types
// First, key type (for Maps, Map-like types):
if (type.isMapLikeType()) {
JavaType keyType = type.getKeyType();
Class<?> keyClass = findSerializationKeyType(a, keyType);
if (keyClass != null) {
if (keyType.hasRawClass(keyClass)) {
keyType = keyType.withStaticTyping();
} else {
Class<?> currRaw = keyType.getRawClass();
try {
// 19-May-2016, tatu: As per [databind#1231], [databind#1178] may need to actually
// specialize (narrow) type sometimes, even if more commonly opposite
// is needed.
if (keyClass.isAssignableFrom(currRaw)) { // common case
keyType = tf.constructGeneralizedType(keyType, keyClass);
} else if (currRaw.isAssignableFrom(keyClass)) { // specialization, ok as well
keyType = tf.constructSpecializedType(keyType, keyClass);
} else {
throw new JsonMappingException(null,
String.format("Can not refine serialization key type %s into %s; types not related",
keyType,
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS> keyClass.getName()));
}
} catch (IllegalArgumentException iae) {
throw new JsonMappingException(null,
String.format("Failed to widen key type of %s with concrete-type annotation (value %s), from '%s': %s",
type, keyClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
type = ((MapLikeType) type).withKeyType(keyType);
}
}
JavaType contentType = type.getContentType();
if (contentType != null) { // collection[like], map[like], array, reference
// And then value types for all containers:
Class<?> contentClass = findSerializationContentType(a, contentType);
if (contentClass != null) {
if (contentType.hasRawClass(contentClass)) {
contentType = contentType.withStaticTyping();
} else {
// 03-Apr-2016, tatu: As per [databind#1178], may need to actually
// specialize (narrow) type sometimes, even if more commonly opposite
// is needed.
Class<?> currRaw = contentType.getRawClass();
try {
if (contentClass.isAssignableFrom(currRaw)) { // common case
contentType = tf.constructGeneralizedType(contentType, contentClass);
} else if (currRaw.isAssignableFrom(contentClass)) { // specialization, ok as well
contentType = tf.constructSpecializedType(contentType, contentClass);
} else {
throw new JsonMappingException(null,
String.format("Can not refine serialization content type %s into %s; types not related",
contentType, contentClass.getName()));
}
} catch (IllegalArgumentException iae) { // shouldn't really happen
throw new JsonMappingException(null,
String.format("Internal error: failed to refine value type of %s with concrete-type annotation (value %s), from '%s': %s",
type, contentClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
type = type.withContentType(contentType);
}
}
return type;
}
/*
/**********************************************************
/* Serialization: class annotations
/**********************************************************
*/
/**
* Method for accessing defined property serialization order (which may be
* partial). May return null
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>': %s",
type, valueClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
// Then further processing for container types
// First, key type (for Maps, Map-like types):
if (type.isMapLikeType()) {
JavaType keyType = type.getKeyType();
Class<?> keyClass = findDeserializationKeyType(a, keyType);
if (keyClass != null) {
try {
keyType = tf.constructSpecializedType(keyType, keyClass);
type = ((MapLikeType) type).withKeyType(keyType);
} catch (IllegalArgumentException iae) {
throw new JsonMappingException(null,
String.format("Failed to narrow key type of %s with concrete-type annotation (value %s), from '%s': %s",
type, keyClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
}
JavaType contentType = type.getContentType();
if (contentType != null) { // collection[like], map[like], array, reference
// And then value types for all containers:
Class<?> contentClass = findDeserializationContentType(a, contentType);
if (contentClass != null) {
try {
contentType = tf.constructSpecializedType(contentType, contentClass);
type = type.withContentType(contentType);
} catch (IllegalArgumentException iae) {
throw new JsonMappingException(null,
String.format("Failed to narrow value type of %s with concrete-type annotation (value %s), from '%s': %s",
type, contentClass.getName(), a.getName(), iae.getMessage()),
iae);
}
}
}
return type;
}
/**
* Method for accessing annotated type definition that a
* property can have, to be used as the type for deserialization
* instead of the static (declared) type.
* Type is usually narrowing conversion (i.e.subtype of declared type).
* Declared return type of the method is also considered acceptable.
*
* @param baseType Assumed type before considering annotations
*
* @return Class to use for deserialization instead of declared type
*
* @deprecated Since 2.7 call {@link #refineDeserializationType} instead
*/
@Deprecated
public
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>package com.fasterxml.jackson.databind.introspect;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.type.TypeBindings;
/**
* Shared base class used for anything on which annotations (included
* within a {@link AnnotationMap}).
*/
public abstract class Annotated
{
protected Annotated() { }
public abstract <A extends Annotation> A getAnnotation(Class<A> acls);
public abstract boolean hasAnnotation(Class<?> acls);
/**
* @since 2.7
*/
public abstract boolean hasOneOf(Class<? extends Annotation>[] annoClasses);
/**
* Fluent factory method that will construct a new instance that uses specified
* instance annotations instead of currently configured ones.
*/
public abstract Annotated withAnnotations(AnnotationMap fallback);
/**
* Fluent factory method that will construct a new instance that uses
* annotations from specified {@link Annotated} as fallback annotations
*/
public final Annotated withFallBackAnnotationsFrom(Annotated annotated) {
return withAnnotations(AnnotationMap.merge(getAllAnnotations(), annotated.getAllAnnotations()));
}
/**
* Method that can be used to find actual JDK element that this instance
* represents. It is non-null, except for method/constructor parameters
* which do not have a JDK counterpart.
*/
public abstract AnnotatedElement getAnnotated();
protected abstract int getModifiers();
public final boolean isPublic() {
return Modifier.isPublic(getModifiers());
}
public abstract String getName();
/**
* Full generic type of the annotated element; definition
* of what exactly this means depends on sub-class.
*
* @since 2.7
*/
public abstract JavaType getType();
/**
* @deprecated Since 2.7 Use {@link #getType()} instead. To be removed from 2.9
*/
@Deprecated
public final JavaType getType(TypeBindings bogus) {
return getType();
}
/**
* JDK declared generic type of the annotated element; definition
* of what exactly this means depends on sub-class. Note that such type
* can not be reliably resolved
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
return _children.values().iterator();
}
@Override
public JsonNode get(int index) { return null; }
@Override
public JsonNode get(String fieldName) {
return _children.get(fieldName);
}
@Override
public Iterator<String> fieldNames() {
return _children.keySet().iterator();
}
@Override
public JsonNode path(int index) {
return MissingNode.getInstance();
}
@Override
public JsonNode path(String fieldName)
{
JsonNode n = _children.get(fieldName);
if (n != null) {
return n;
}
return MissingNode.getInstance();
}
/**
* Method to use for accessing all fields (with both names
* and values) of this JSON Object.
*/
@Override
public Iterator<Map.Entry<String, JsonNode>> fields() {
return _children.entrySet().iterator();
}
@Override
public ObjectNode with(String propertyName) {
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ObjectNode) {
return (ObjectNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ObjectNode (but " + n
.getClass().getName() + ")");
}
ObjectNode result = objectNode();
_children.put(propertyName, result);
return result;
}
@Override
public ArrayNode withArray(String propertyName)
{
JsonNode n = _children.get(propertyName);
if (n != null) {
if (n instanceof ArrayNode) {
return (ArrayNode) n;
}
throw new UnsupportedOperationException("Property '" + propertyName
+ "' has value that is not of type ArrayNode (but " + n
.getClass().getName() + ")");
}
ArrayNode result = arrayNode();
_children.put(propertyName, result);
return result;
}
@Override
public boolean equals(Comparator<JsonNode> comparator, JsonNode o)
{
if (!(o instanceof ObjectNode)) {
return false;
}
ObjectNode other = (ObjectNode) o;
Map<String, JsonNode> m1 = _children;
Map<String, JsonNode> m2 = other._children;
final int len = m1.size();
if (m2
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
gen.writeNumber((Short) n);
} else {
gen.writeNumber(((Number) n).intValue());
}
}
break;
case VALUE_NUMBER_FLOAT:
{
Object n = segment.get(ptr);
if (n instanceof Double) {
gen.writeNumber(((Double) n).doubleValue());
} else if (n instanceof BigDecimal) {
gen.writeNumber((BigDecimal) n);
} else if (n instanceof Float) {
gen.writeNumber(((Float) n).floatValue());
} else if (n == null) {
gen.writeNull();
} else if (n instanceof String) {
gen.writeNumber((String) n);
} else {
throw new JsonGenerationException(String.format(
"Unrecognized value type for VALUE_NUMBER_FLOAT: %s, can not serialize",
n.getClass().getName()), gen);
}
}
break;
case VALUE_TRUE:
gen.writeBoolean(true);
break;
case VALUE_FALSE:
gen.writeBoolean(false);
break;
case VALUE_NULL:
gen.writeNull();
break;
case VALUE_EMBEDDED_OBJECT:
{
Object value = segment.get(ptr);
// 01-Sep-2016, tatu: as per [databind#1361], should use `writeEmbeddedObject()`;
// however, may need to consider alternatives for some well-known types
// first
if (value instanceof RawValue) {
((RawValue) value).serialize(gen);
} else if (value instanceof JsonSerializable) {
gen.writeObject(value);
} else {
gen.writeEmbeddedObject(value);
}
}
break;
default:
throw new RuntimeException("Internal error: should never end up through this code path");
}
}
}
/**
* Helper method used by standard deserializer.
*
* @since 2.3
*/
public TokenBuffer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException
{
if (p.getCurrentTokenId() != JsonToken.FIELD_NAME.id()) {
copyCurrentStructure(p);
return this;
}
/* 28-Oct-2014, tatu: As per [databind#
JacksonDatabind, 73
<FILEB>
<CHANGES>
import com.fasterxml.jackson.annotation.JsonProperty.Access;
<CHANGEE>
<CHANGES>
Access acc = prop.removeNonVisible(inferMutators);
if (!_forSerialization && (acc == Access.READ_ONLY)) {
_collectIgnorals(prop.getName());
}
<CHANGEE>
<FILEE>
<FILEB>
<CHANGES>
public JsonProperty.Access removeNonVisible(boolean inferMutators)
<CHANGEE>
<CHANGES>
return acc;
<CHANGEE>
<FILEE>
<FILEB>
package com.fasterxml.jackson.databind.introspect;
import java.lang.reflect.Modifier;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonAnySetter;
<CHANGES>
<CHANGEE>
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.HandlerInstantiator;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Helper class used for aggregating information about all possible
* properties of a POJO.
*/
public class POJOPropertiesCollector
{
/*
if (!_forSerialization && !prop.couldDeserialize()) {
_collectIgnorals(prop.getName());
}
}
}
}
/**
* Method called to further get rid of unwanted individual accessors,
* based on read/write settings and rules for "pulling in" accessors
* (or not).
*/
protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props)
{
final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS);
Iterator<POJOPropertyBuilder> it = props.values().iterator();
while (it.hasNext()) {
POJOPropertyBuilder prop = it.next();
// 26-Jan-2017, tatu: [databind#935]: need to denote removal of
<CHANGES>
prop.removeNonVisible(inferMutators);
<CHANGEE>
}
}
/**
* Helper method called to add explicitly ignored properties to a list
* of known ignored properties; this helps in proper reporting of
* errors.
*/
private void _collectIgnorals(String name)
{
if (!_forSerialization) {
if (_ignoredPropertyNames == null) {
_ignoredPropertyNames = new HashSet<String>();
<FILEE>
<FILEB>
/* Modifications
/**********************************************************
*/
/**
* Method called to remove all entries that are marked as
* ignored.
*/
public void removeIgnored()
{
_fields = _removeIgnored(_fields);
_getters = _removeIgnored(_getters);
_setters = _removeIgnored(_setters);
_ctorParameters =<SCANS>
}
@Override
public double getDoubleValue() throws IOException {
return getNumberValue().doubleValue();
}
@Override
public float getFloatValue() throws IOException {
return getNumberValue().floatValue();
}
@Override
public int getIntValue() throws IOException
{
// optimize common case:
if (_currToken == JsonToken.VALUE_NUMBER_INT) {
return ((Number) _currentObject()).intValue();
}
return getNumberValue().intValue();
}
@Override
public long getLongValue() throws IOException {
return getNumberValue().longValue();
}
@Override
public NumberType getNumberType() throws IOException
{
Number n = getNumberValue();
if (n instanceof Integer) return NumberType.INT;
if (n instanceof Long) return NumberType.LONG;
if (n instanceof Double) return NumberType.DOUBLE;
if (n instanceof BigDecimal) return NumberType.BIG_DECIMAL;
if (n instanceof BigInteger) return NumberType.BIG_INTEGER;
if (n instanceof Float) return NumberType.FLOAT;
if (n instanceof Short) return NumberType.INT; // should be SHORT
return null;
}
@Override
public final Number getNumberValue() throws IOException {
_checkIsNumber();
Object value = _currentObject();
if (value instanceof Number) {
return (Number) value;
}
// Difficult to really support numbers-as-Strings; but let's try.
// NOTE: no access to DeserializationConfig, unfortunately, so can not
// try to determine Double/BigDecimal preference...
if (value instanceof String) {
String str = (String) value;
if (str.indexOf('.') >= 0) {
return Double.parseDouble(str);
}
return Long.parseLong(str);
}
if (value == null) {
return null;
}
throw new IllegalStateException("Internal error: entry should be a Number, but is of type "
+value.getClass().getName());
}
/*
/**********************************************************
/* Public API, access to token information, other
/**********************************************************
*/
@Override
public Object getEmbeddedObject()
{
if (_currToken == JsonToken.VALUE_EMBEDDED_OBJECT) {
return _currentObject();
}
return null;